fix getExistingObject method for several controller.

This commit is contained in:
Manuel Raynaud
2014-01-20 12:01:25 +01:00
parent 809d2631c0
commit 3e4eff172f
14 changed files with 100 additions and 45 deletions

View File

@@ -137,9 +137,14 @@ class AttributeAvController extends AbstractCrudController
protected function getExistingObject() protected function getExistingObject()
{ {
return AttributeAvQuery::create() $attributeAv = AttributeAvQuery::create()
->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('attributeav_id', 0));
->findOneById($this->getRequest()->get('attributeav_id'));
if (null !== $attributeAv) {
$attribute->setLocale($this->getCurrentEditionLocale());
}
return $attributeAv;
} }
protected function getObjectLabel($object) protected function getObjectLabel($object)

View File

@@ -167,9 +167,14 @@ class AttributeController extends AbstractCrudController
protected function getExistingObject() protected function getExistingObject()
{ {
return AttributeQuery::create() $attribute = AttributeQuery::create()
->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('attribute_id', 0));
->findOneById($this->getRequest()->get('attribute_id'));
if (null !== $attribute) {
$attribute->setLocale($this->getCurrentEditionLocale());
}
return $attribute;
} }
protected function getObjectLabel($object) protected function getObjectLabel($object)

View File

@@ -140,9 +140,14 @@ class ConfigController extends AbstractCrudController
protected function getExistingObject() protected function getExistingObject()
{ {
return ConfigQuery::create() $config = ConfigQuery::create()
->joinWithI18n($this->getCurrentEditionLocale())
->findOneById($this->getRequest()->get('variable_id')); ->findOneById($this->getRequest()->get('variable_id'));
if (null !== $config) {
$config->setLocale($this->getCurrentEditionLocale());
}
return $config;
} }
protected function getObjectLabel($object) protected function getObjectLabel($object)

View File

@@ -120,8 +120,6 @@ class CountryController extends AbstractCrudController
$event $event
->setLocale($formData['locale']) ->setLocale($formData['locale'])
->setTitle($formData['title']) ->setTitle($formData['title'])
->setChapo($formData['chapo'])
->setDescription($formData['description'])
->setIsocode($formData['isocode']) ->setIsocode($formData['isocode'])
->setIsoAlpha2($formData['isoalpha2']) ->setIsoAlpha2($formData['isoalpha2'])
->setIsoAlpha3($formData['isoalpha3']) ->setIsoAlpha3($formData['isoalpha3'])
@@ -164,9 +162,14 @@ class CountryController extends AbstractCrudController
*/ */
protected function getExistingObject() protected function getExistingObject()
{ {
return CountryQuery::create() $country = CountryQuery::create()
->joinWithI18n($this->getCurrentEditionLocale())
->findPk($this->getRequest()->get('country_id', 0)); ->findPk($this->getRequest()->get('country_id', 0));
if (null !== $country) {
$country->setLocale($this->getCurrentEditionLocale());
}
return $country;
} }
/** /**

View File

@@ -141,9 +141,14 @@ class CurrencyController extends AbstractCrudController
protected function getExistingObject() protected function getExistingObject()
{ {
return CurrencyQuery::create() $currency = CurrencyQuery::create()
->joinWithI18n($this->getCurrentEditionLocale())
->findOneById($this->getRequest()->get('currency_id')); ->findOneById($this->getRequest()->get('currency_id'));
if (null !== $currency) {
$currency->setLocale($this->getCurrentEditionLocale());
}
return $currency;
} }
protected function getObjectLabel($object) protected function getObjectLabel($object)

View File

@@ -137,9 +137,14 @@ class FeatureAvController extends AbstractCrudController
protected function getExistingObject() protected function getExistingObject()
{ {
return FeatureAvQuery::create() $featureAv = FeatureAvQuery::create()
->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('featureav_id', 0));
->findOneById($this->getRequest()->get('featureav_id'));
if (null !== $featureAv) {
$featureAv->setLocale($this->getCurrentEditionLocale());
}
return $featureAv;
} }
protected function getObjectLabel($object) protected function getObjectLabel($object)

View File

@@ -167,9 +167,14 @@ class FeatureController extends AbstractCrudController
protected function getExistingObject() protected function getExistingObject()
{ {
return FeatureQuery::create() $feature = FeatureQuery::create()
->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('feature_id', 0));
->findOneById($this->getRequest()->get('feature_id'));
if (null !== $feature) {
$feature->setLocale($this->getCurrentEditionLocale());
}
return $feature;
} }
protected function getObjectLabel($object) protected function getObjectLabel($object)

View File

@@ -143,9 +143,14 @@ class MessageController extends AbstractCrudController
protected function getExistingObject() protected function getExistingObject()
{ {
return MessageQuery::create() $message = MessageQuery::create()
->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('message_id', 0));
->findOneById($this->getRequest()->get('message_id'));
if (null !== $message) {
$message->setLocale($this->getCurrentEditionLocale());
}
return $message;
} }
protected function getObjectLabel($object) protected function getObjectLabel($object)

View File

@@ -144,9 +144,14 @@ class ModuleController extends AbstractCrudController
protected function getExistingObject() protected function getExistingObject()
{ {
return ModuleQuery::create() $module = ModuleQuery::create()
->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('module_id', 0));
->findOneById($this->getRequest()->get('module_id'));
if (null !== $module) {
$module->setLocale($this->getCurrentEditionLocale());
}
return $module;
} }
protected function getObjectLabel($object) protected function getObjectLabel($object)

View File

@@ -145,9 +145,14 @@ class ProfileController extends AbstractCrudController
protected function getExistingObject() protected function getExistingObject()
{ {
return ProfileQuery::create() $profile = ProfileQuery::create()
->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('profile_id', 0));
->findOneById($this->getRequest()->get('profile_id'));
if (null !== $profile) {
$profile->setLocale($this->getCurrentEditionLocale());
}
return $profile;
} }
protected function getObjectLabel($object) protected function getObjectLabel($object)

View File

@@ -121,9 +121,14 @@ class TaxController extends AbstractCrudController
protected function getExistingObject() protected function getExistingObject()
{ {
return TaxQuery::create() $tax = TaxQuery::create()
->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('tax_id', 0));
->findOneById($this->getRequest()->get('tax_id'));
if (null !== $tax) {
$tax->setLocale($this->getCurrentEditionLocale());
}
return $tax;
} }
protected function getObjectLabel($object) protected function getObjectLabel($object)

View File

@@ -140,9 +140,14 @@ class TaxRuleController extends AbstractCrudController
protected function getExistingObject() protected function getExistingObject()
{ {
return TaxRuleQuery::create() $taxRule = TaxRuleQuery::create()
->joinWithI18n($this->getCurrentEditionLocale())
->findOneById($this->getRequest()->get('tax_rule_id')); ->findOneById($this->getRequest()->get('tax_rule_id'));
if (null !== $taxRule) {
$taxRule->setLocale($this->getCurrentEditionLocale());
}
return $taxRule;
} }
protected function getObjectLabel($object) protected function getObjectLabel($object)

View File

@@ -129,9 +129,14 @@ class TemplateController extends AbstractCrudController
protected function getExistingObject() protected function getExistingObject()
{ {
return TemplateQuery::create() $template = TemplateQuery::create()
->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('template_id', 0));
->findOneById($this->getRequest()->get('template_id'));
if (null !== $template) {
$template->setLocale($this->getCurrentEditionLocale());
}
return $template;
} }
protected function getObjectLabel($object) protected function getObjectLabel($object)

View File

@@ -178,14 +178,6 @@
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/system-logs'}"><i class="glyphicon glyphicon-edit"></i></a></td> <td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/system-logs'}"><i class="glyphicon glyphicon-edit"></i></a></td>
</tr> </tr>
{/loop} {/loop}
{loop type="auth" name="pcc9" role="ADMIN" resource="admin.configuration.update" access="VIEW"}
<tr>
<td><a href="{url path='/admin/configuration/update'}">{intl l='Update your Thelia'}</a></td>
<td><a class="btn btn-default btn-xs" href="{url path='/admin/configuration/update'}"><i class="glyphicon glyphicon-edit"></i></a></td>
</tr>
{/loop}
{module_include location='system_configuration_bottom'} {module_include location='system_configuration_bottom'}
</table> </table>
</div> </div>