This commit is contained in:
Franck Allimant
2014-01-20 23:38:33 +01:00
32 changed files with 246 additions and 107 deletions

View File

@@ -114,26 +114,6 @@ class AdministratorController extends AbstractCrudController
return new AdministratorModificationForm($this->getRequest(), "form", $data);
}
protected function hydrateResourceUpdateForm($object)
{
$data = array(
'id' => $object->getId(),
);
// Setup the object form
return new AdministratorUpdateResourceAccessForm($this->getRequest(), "form", $data);
}
protected function hydrateModuleUpdateForm($object)
{
$data = array(
'id' => $object->getId(),
);
// Setup the object form
return new AdministratorUpdateModuleAccessForm($this->getRequest(), "form", $data);
}
protected function getObjectFromEvent($event)
{
return $event->hasAdministrator() ? $event->getAdministrator() : null;
@@ -142,7 +122,6 @@ class AdministratorController extends AbstractCrudController
protected function getExistingObject()
{
return AdminQuery::create()
->joinWithI18n($this->getCurrentEditionLocale())
->findOneById($this->getRequest()->get('administrator_id'));
}

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

@@ -85,7 +85,12 @@ class ConfigStoreController extends BaseAdminController
$this->adminLogAppend(AdminResources::STORE, AccessManager::UPDATE, "Store configuration changed");
$this->redirectToRoute('admin.configuration.store.default');
if ($this->getRequest()->get('save_mode') == 'stay') {
$this->redirectToRoute('admin.configuration.store.default');
}
// Redirect to the success URL
$this->redirect($configStoreForm->getSuccessUrl());
} catch (\Exception $ex) {
$error_msg = $ex->getMessage();

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

@@ -62,7 +62,8 @@ class CustomerUpdateForm extends BaseForm
"label" => Translator::getInstance()->trans("Company"),
"label_attr" => array(
"for" => "company"
)
),
"required" => false
))
->add("firstname", "text", array(
"constraints" => array(