diff --git a/core/lib/Thelia/Controller/Admin/CategoryController.php b/core/lib/Thelia/Controller/Admin/CategoryController.php index d2e0a0e9c..8dcba2cbe 100755 --- a/core/lib/Thelia/Controller/Admin/CategoryController.php +++ b/core/lib/Thelia/Controller/Admin/CategoryController.php @@ -156,9 +156,14 @@ class CategoryController extends AbstractSeoCrudController protected function getExistingObject() { - return CategoryQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) - ->findOneById($this->getRequest()->get('category_id', 0)); + $category = CategoryQuery::create() + ->findOneById($this->getRequest()->get('category_id', 0)); + + if (null !== $category) { + $category->setLocale($this->getCurrentEditionLocale()); + } + + return $category; } protected function getObjectLabel($object) diff --git a/core/lib/Thelia/Controller/Admin/ContentController.php b/core/lib/Thelia/Controller/Admin/ContentController.php index bcb588800..472d249ee 100644 --- a/core/lib/Thelia/Controller/Admin/ContentController.php +++ b/core/lib/Thelia/Controller/Admin/ContentController.php @@ -236,9 +236,13 @@ class ContentController extends AbstractSeoCrudController */ protected function getExistingObject() { - return ContentQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) + $content = ContentQuery::create() ->findOneById($this->getRequest()->get('content_id', 0)); + + if (null !== $content) { + $content->setLocale($this->getCurrentEditionLocale()); + } + return $content; } /** diff --git a/core/lib/Thelia/Controller/Admin/FolderController.php b/core/lib/Thelia/Controller/Admin/FolderController.php index d34ebf283..5d1f13293 100644 --- a/core/lib/Thelia/Controller/Admin/FolderController.php +++ b/core/lib/Thelia/Controller/Admin/FolderController.php @@ -199,9 +199,13 @@ class FolderController extends AbstractSeoCrudController */ protected function getExistingObject() { - return FolderQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) + $folder = FolderQuery::create() ->findOneById($this->getRequest()->get('folder_id', 0)); + + if (null !== $folder) { + $folder->setLocale($this->getCurrentEditionLocale()); + } + return $folder; } /** diff --git a/core/lib/Thelia/Controller/Admin/ProductController.php b/core/lib/Thelia/Controller/Admin/ProductController.php index 549ee6609..38cd917ea 100644 --- a/core/lib/Thelia/Controller/Admin/ProductController.php +++ b/core/lib/Thelia/Controller/Admin/ProductController.php @@ -343,9 +343,14 @@ class ProductController extends AbstractSeoCrudController protected function getExistingObject() { - return ProductQuery::create() - ->joinWithI18n($this->getCurrentEditionLocale()) - ->findOneById($this->getRequest()->get('product_id', 0)); + $product = ProductQuery::create() + ->findOneById($this->getRequest()->get('product_id', 0)); + + if (null !== $product) { + $product->setLocale($this->getCurrentEditionLocale()); + } + + return $product; } protected function getObjectLabel($object)