From 06bb1d0a3980b509f8de5b12e6f97f02f04e16f8 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Wed, 11 Sep 2013 08:57:59 +0200 Subject: [PATCH 1/2] change some getters --- .../Core/HttpFoundation/Session/Session.php | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php index dd6af30d2..f2eaadc4d 100755 --- a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php +++ b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php @@ -47,7 +47,12 @@ class Session extends BaseSession */ public function getLang($forceDefault = true) { - return $this->get("thelia.current.lang", $forceDefault ? Lang::getDefaultLanguage():null); + $lang = $this->get("thelia.current.lang"); + if(null === $lang && $forceDefault) + { + $lang = Lang::getDefaultLanguage(); + } + return $lang; } public function setLang(Lang $lang) @@ -59,7 +64,12 @@ class Session extends BaseSession public function getAdminEditionLang() { - return $this->get('thelia.admin.edition.lang', Lang::getDefaultLanguage()); + $lang = $this->get('thelia.admin.edition.lang'); + + if (null === $lang) { + $lang = Lang::getDefaultLanguage(); + } + return $lang; } public function setAdminEditionLang($langId) @@ -76,7 +86,13 @@ class Session extends BaseSession public function getCurrency($forceDefault = true) { - return $this->get("thelia.current.currency", $forceDefault ? Currency::getDefaultCurrency():null); + $currency = $this->get("thelia.current.currency"); + + if(null === $currency && $forceDefault) + { + $currency = Currency::getDefaultCurrency(); + } + return $currency; } // -- Customer user -------------------------------------------------------- From 90024848149dec081f06e3a7a02238592ff58383 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Wed, 11 Sep 2013 09:13:42 +0200 Subject: [PATCH 2/2] change find method on some request --- core/lib/Thelia/Model/Tools/ModelCriteriaTools.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php b/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php index 5e5dae010..c7426ef71 100755 --- a/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php +++ b/core/lib/Thelia/Model/Tools/ModelCriteriaTools.php @@ -110,7 +110,7 @@ class ModelCriteriaTools { // If a lang has been requested, find the related Lang object, and get the locale if ($requestedLangId !== null) { - $localeSearch = LangQuery::create()->findOneById($requestedLangId); + $localeSearch = LangQuery::create()->findPk($requestedLangId); if ($localeSearch === null) { throw new \InvalidArgumentException(sprintf('Incorrect lang argument given : lang ID %d not found', $requestedLangId));