merged branch franmomu/reuse_variable_formpass (PR #7464)

This PR was merged into the 2.1 branch.

Discussion
----------

[FrameworkBundle] Reuse definition variable in FormPass

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

f52320d [FrameworkBundle] Reuse definition variable in FormPass
This commit is contained in:
Fabien Potencier 2013-03-24 08:11:17 +01:00
commit d9009cb3c6
1 changed files with 5 additions and 3 deletions

View File

@ -28,6 +28,8 @@ class FormPass implements CompilerPassInterface
return;
}
$definition = $container->getDefinition('form.extension');
// Builds an array with service IDs as keys and tag aliases as values
$types = array();
@ -40,7 +42,7 @@ class FormPass implements CompilerPassInterface
$types[$alias] = $serviceId;
}
$container->getDefinition('form.extension')->replaceArgument(1, $types);
$definition->replaceArgument(1, $types);
$typeExtensions = array();
@ -52,11 +54,11 @@ class FormPass implements CompilerPassInterface
$typeExtensions[$alias][] = $serviceId;
}
$container->getDefinition('form.extension')->replaceArgument(2, $typeExtensions);
$definition->replaceArgument(2, $typeExtensions);
// Find all services annotated with "form.type_guesser"
$guessers = array_keys($container->findTaggedServiceIds('form.type_guesser'));
$container->getDefinition('form.extension')->replaceArgument(3, $guessers);
$definition->replaceArgument(3, $guessers);
}
}