Skip to content

Commit

Permalink
Update FormTypeCsrfExtension.php
Browse files Browse the repository at this point in the history
There is no need to store the FormFactory in an Attribute.
The FormFactory can be retrieved directly.
  • Loading branch information
tweini committed Sep 25, 2013
1 parent 5ebaad3 commit 90d59ea
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
}

$builder
->setAttribute('csrf_factory', $builder->getFormFactory())
->addEventSubscriber(new CsrfValidationListener(
$options['csrf_field_name'],
$options['csrf_provider'],
Expand All @@ -94,7 +93,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
public function finishView(FormView $view, FormInterface $form, array $options)
{
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']);

$csrfForm = $factory->createNamed($options['csrf_field_name'], 'hidden', $data, array(
Expand Down

0 comments on commit 90d59ea

Please sign in to comment.