From 76e45f540110d218e96e7a9a09bf61d6152b2d84 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Wed, 6 Mar 2013 10:32:03 +0100 Subject: [PATCH] Fix set_locale method --- lib/classes/User/Adapter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/classes/User/Adapter.php b/lib/classes/User/Adapter.php index c1f8591467..c62af33b4d 100644 --- a/lib/classes/User/Adapter.php +++ b/lib/classes/User/Adapter.php @@ -1645,11 +1645,11 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function set_locale($locale) { - if (!in_array($locale, $this->app->getAvailableLanguages())) { + if (!array_key_exists($locale, $this->app->getAvailableLanguages())) { throw new \InvalidArgumentException(sprintf('Locale %s is not recognized', $locale)); } - $sql = 'UPDATE usr SET lccale = :locale WHERE usr_id = :usr_id'; + $sql = 'UPDATE usr SET locale = :locale WHERE usr_id = :usr_id'; $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(array(':locale' => $locale, ':usr_id' => $this->get_id())); $stmt->closeCursor();