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()
{
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)

View File

@@ -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;
}
/**

View File

@@ -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;
}
/**

View File

@@ -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)