[FrameworkBundle] AddFormTypesPass now uses the service ID as alias if no alias is given
This commit is contained in:
parent
40ee22c8b4
commit
9c4095a356
@ -29,16 +29,17 @@ class AddFormTypesPass implements CompilerPassInterface
|
||||
}
|
||||
|
||||
// Builds an array with service IDs as keys and tag aliases as values
|
||||
$types = array_map(function ($arguments) {
|
||||
if (!isset($arguments[0]['alias'])) {
|
||||
// TODO throw exception
|
||||
}
|
||||
$types = array();
|
||||
$tags = $container->findTaggedServiceIds('form.type');
|
||||
|
||||
return $arguments[0]['alias'];
|
||||
}, $container->findTaggedServiceIds('form.type'));
|
||||
foreach ($tags as $serviceId => $arguments) {
|
||||
$alias = isset($arguments[0]['alias'])
|
||||
? $arguments[0]['alias']
|
||||
: $serviceId;
|
||||
|
||||
// Flip, because we want tag aliases (= type identifiers) as keys
|
||||
$types = array_flip($types);
|
||||
// Flip, because we want tag aliases (= type identifiers) as keys
|
||||
$types[$alias] = $serviceId;
|
||||
}
|
||||
|
||||
$container->getDefinition('form.type.loader.tagged')->setArgument(1, $types);
|
||||
}
|
||||
|
Reference in New Issue
Block a user