Fixed injection of TaxManager in TaxCreationForm instance
This commit is contained in:
@@ -50,14 +50,14 @@ class TaxController extends AbstractCrudController
|
||||
|
||||
protected function getCreationForm()
|
||||
{
|
||||
$form = new TaxCreationForm($this->getRequest());
|
||||
$form = new TaxCreationForm($this->getRequest(), 'form', array(), array(), $this->container->get('thelia.taxEngine'));
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
protected function getUpdateForm()
|
||||
{
|
||||
return new TaxModificationForm($this->getRequest());
|
||||
return new TaxModificationForm($this->getRequest(), 'form', array(), array(), $this->container->get('thelia.taxEngine'));
|
||||
}
|
||||
|
||||
protected function getCreationEvent($formData)
|
||||
@@ -114,7 +114,7 @@ class TaxController extends AbstractCrudController
|
||||
);
|
||||
|
||||
// Setup the object form
|
||||
return new TaxModificationForm($this->getRequest(), "form", $data);
|
||||
return new TaxModificationForm($this->getRequest(), "form", $data, array(), $this->container->get('thelia.taxEngine'));
|
||||
}
|
||||
|
||||
protected function getObjectFromEvent($event)
|
||||
@@ -158,7 +158,6 @@ class TaxController extends AbstractCrudController
|
||||
|
||||
protected function renderListTemplate($currentOrder)
|
||||
{
|
||||
// We always return to the feature edition form
|
||||
return $this->render(
|
||||
'taxes-rules',
|
||||
array()
|
||||
|
||||
@@ -32,6 +32,7 @@ use Thelia\Form\TaxRuleModificationForm;
|
||||
use Thelia\Form\TaxRuleTaxListUpdateForm;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\TaxRuleQuery;
|
||||
use Thelia\Form\TaxCreationForm;
|
||||
|
||||
class TaxRuleController extends AbstractCrudController
|
||||
{
|
||||
@@ -50,6 +51,22 @@ class TaxRuleController extends AbstractCrudController
|
||||
);
|
||||
}
|
||||
|
||||
public function defaultAction() {
|
||||
|
||||
// In the tax rule template we use the TaxCreationForm.
|
||||
//
|
||||
// The TaxCreationForm require the TaxEngine, but we cannot pass it from the Parser Form plugin,
|
||||
// as the container is not passed to forms by this plugin.
|
||||
//
|
||||
// So we create an instance of TaxCreationForm here (we have the container), and put it in the ParserContext.
|
||||
// This way, the Form plugin will use this instance, instead on creating it.
|
||||
$taxCreationForm = new TaxCreationForm($this->getRequest(), 'form', array(), array(), $this->container->get('thelia.taxEngine'));
|
||||
|
||||
$this->getParserContext()->addForm($taxCreationForm);
|
||||
|
||||
return parent::defaultAction();
|
||||
}
|
||||
|
||||
protected function getCreationForm()
|
||||
{
|
||||
return new TaxRuleCreationForm($this->getRequest());
|
||||
|
||||
Reference in New Issue
Block a user