AbstractController::getExistingObject return object with hte needed

locale inside
This commit is contained in:
Manuel Raynaud
2014-01-14 14:39:08 +01:00
parent 34da3937dc
commit eb5056f089
4 changed files with 28 additions and 10 deletions

View File

@@ -156,9 +156,14 @@ class CategoryController extends AbstractSeoCrudController
protected function getExistingObject() protected function getExistingObject()
{ {
return CategoryQuery::create() $category = CategoryQuery::create()
->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('category_id', 0));
->findOneById($this->getRequest()->get('category_id', 0));
if (null !== $category) {
$category->setLocale($this->getCurrentEditionLocale());
}
return $category;
} }
protected function getObjectLabel($object) protected function getObjectLabel($object)

View File

@@ -236,9 +236,13 @@ class ContentController extends AbstractSeoCrudController
*/ */
protected function getExistingObject() protected function getExistingObject()
{ {
return ContentQuery::create() $content = ContentQuery::create()
->joinWithI18n($this->getCurrentEditionLocale())
->findOneById($this->getRequest()->get('content_id', 0)); ->findOneById($this->getRequest()->get('content_id', 0));
if (null !== $content) {
$content->setLocale($this->getCurrentEditionLocale());
}
return $content;
} }
/** /**

View File

@@ -199,9 +199,13 @@ class FolderController extends AbstractSeoCrudController
*/ */
protected function getExistingObject() protected function getExistingObject()
{ {
return FolderQuery::create() $folder = FolderQuery::create()
->joinWithI18n($this->getCurrentEditionLocale())
->findOneById($this->getRequest()->get('folder_id', 0)); ->findOneById($this->getRequest()->get('folder_id', 0));
if (null !== $folder) {
$folder->setLocale($this->getCurrentEditionLocale());
}
return $folder;
} }
/** /**

View File

@@ -343,9 +343,14 @@ class ProductController extends AbstractSeoCrudController
protected function getExistingObject() protected function getExistingObject()
{ {
return ProductQuery::create() $product = ProductQuery::create()
->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('product_id', 0));
->findOneById($this->getRequest()->get('product_id', 0));
if (null !== $product) {
$product->setLocale($this->getCurrentEditionLocale());
}
return $product;
} }
protected function getObjectLabel($object) protected function getObjectLabel($object)