Fixed injection of TaxManager in TaxCreationForm instance
This commit is contained in:
@@ -50,7 +50,7 @@ class ParserContext implements \IteratorAggregate
|
||||
*/
|
||||
public function addForm(BaseForm $form)
|
||||
{
|
||||
$this->set($form->getName(), $form);
|
||||
$this->set(get_class($form)/*$form->getName()*/, $form);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -97,15 +97,25 @@ class Form extends AbstractSmartyPlugin
|
||||
throw new \InvalidArgumentException("Missing 'name' parameter in form arguments");
|
||||
}
|
||||
|
||||
$instance = $this->createInstance($name);
|
||||
if (!isset($this->formDefinition[$name])) {
|
||||
throw new ElementNotFoundException(sprintf("%s form does not exists", $name));
|
||||
}
|
||||
|
||||
$formClass = $this->formDefinition[$name];
|
||||
|
||||
// Check if parser context contains our form
|
||||
$form = $this->parserContext->getForm($instance->getName());
|
||||
$form = $this->parserContext->getForm($formClass);
|
||||
|
||||
if (null != $form) {
|
||||
// Re-use the form
|
||||
$instance = $form;
|
||||
}
|
||||
else {
|
||||
// Create a new one
|
||||
$class = new \ReflectionClass($formClass);
|
||||
|
||||
$instance = $class->newInstance($this->request, "form");
|
||||
}
|
||||
|
||||
$instance->createView();
|
||||
|
||||
@@ -406,17 +416,6 @@ class Form extends AbstractSmartyPlugin
|
||||
return $instance;
|
||||
}
|
||||
|
||||
protected function createInstance($name)
|
||||
{
|
||||
if (!isset($this->formDefinition[$name])) {
|
||||
throw new ElementNotFoundException(sprintf("%s form does not exists", $name));
|
||||
}
|
||||
|
||||
$class = new \ReflectionClass($this->formDefinition[$name]);
|
||||
|
||||
return $class->newInstance($this->request, "form");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an array of SmartyPluginDescriptor
|
||||
*/
|
||||
|
||||
@@ -87,7 +87,7 @@ class Thelia extends Kernel
|
||||
$con->setAttribute(ConnectionWrapper::PROPEL_ATTR_CACHE_PREPARES, true);
|
||||
if ($this->isDebug()) {
|
||||
$serviceContainer->setLogger('defaultLogger', \Thelia\Log\Tlog::getInstance());
|
||||
$con->useDebug(true);
|
||||
//$con->useDebug(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user