Update FormTypeCsrfExtension.php
There is no need to store the FormFactory in an Attribute. The FormFactory can be retrieved directly.
This commit is contained in:
parent
5ebaad33e6
commit
90d59ea6cd
|
@ -72,7 +72,6 @@ class FormTypeCsrfExtension extends AbstractTypeExtension
|
||||||
}
|
}
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->setAttribute('csrf_factory', $builder->getFormFactory())
|
|
||||||
->addEventSubscriber(new CsrfValidationListener(
|
->addEventSubscriber(new CsrfValidationListener(
|
||||||
$options['csrf_field_name'],
|
$options['csrf_field_name'],
|
||||||
$options['csrf_provider'],
|
$options['csrf_provider'],
|
||||||
|
@ -94,7 +93,7 @@ class FormTypeCsrfExtension extends AbstractTypeExtension
|
||||||
public function finishView(FormView $view, FormInterface $form, array $options)
|
public function finishView(FormView $view, FormInterface $form, array $options)
|
||||||
{
|
{
|
||||||
if ($options['csrf_protection'] && !$view->parent && $options['compound']) {
|
if ($options['csrf_protection'] && !$view->parent && $options['compound']) {
|
||||||
$factory = $form->getConfig()->getAttribute('csrf_factory');
|
$factory = $form->getConfig()->getFormFactory();
|
||||||
$data = $options['csrf_provider']->generateCsrfToken($options['intention']);
|
$data = $options['csrf_provider']->generateCsrfToken($options['intention']);
|
||||||
|
|
||||||
$csrfForm = $factory->createNamed($options['csrf_field_name'], 'hidden', $data, array(
|
$csrfForm = $factory->createNamed($options['csrf_field_name'], 'hidden', $data, array(
|
||||||
|
|
Reference in New Issue