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()
{
return AttributeAvQuery::create()
->joinWithI18n($this->getCurrentEditionLocale())
->findOneById($this->getRequest()->get('attributeav_id'));
$attributeAv = AttributeAvQuery::create()
->findOneById($this->getRequest()->get('attributeav_id', 0));
if (null !== $attributeAv) {
$attribute->setLocale($this->getCurrentEditionLocale());
}
return $attributeAv;
}
protected function getObjectLabel($object)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -129,9 +129,14 @@ class TemplateController extends AbstractCrudController
protected function getExistingObject()
{
return TemplateQuery::create()
->joinWithI18n($this->getCurrentEditionLocale())
->findOneById($this->getRequest()->get('template_id'));
$template = TemplateQuery::create()
->findOneById($this->getRequest()->get('template_id', 0));
if (null !== $template) {
$template->setLocale($this->getCurrentEditionLocale());
}
return $template;
}
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>
</tr>
{/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'}
</table>
</div>