diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php index e1cb5c45c9..4a763a9e3c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php @@ -30,7 +30,7 @@ class FormPass implements CompilerPassInterface $definition = $container->getDefinition('form.extension'); - // Builds an array with service IDs as keys and tag aliases as values + // Builds an array with fully-qualified type class names as keys and service IDs as values $types = array(); foreach ($container->findTaggedServiceIds('form.type') as $serviceId => $tag) { @@ -46,12 +46,8 @@ class FormPass implements CompilerPassInterface foreach ($container->findTaggedServiceIds('form.type_extension') as $serviceId => $tag) { if (isset($tag[0]['extended_type'])) { $extendedType = $tag[0]['extended_type']; - } elseif (isset($tag[0]['alias'])) { - @trigger_error('The alias option of the form.type_extension tag is deprecated since version 2.8 and will be removed in 3.0. Use the extended_type option instead.', E_USER_DEPRECATED); - $extendedType = $tag[0]['alias']; } else { - @trigger_error('The extended_type option of the form.type_extension tag is required since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); - $extendedType = $serviceId; + throw new \InvalidArgumentException(sprintf('Tagged form type extension must have the extended type configured using the extended_type/extended-type attribute, none was configured for the "%s" service.', $serviceId)); } $typeExtensions[$extendedType][] = $serviceId; diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml index 0b2f0ee1f3..5d74391119 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml @@ -50,97 +50,97 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php index 29cefc7104..54dcc928f3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php @@ -45,14 +45,9 @@ class FormPassTest extends \PHPUnit_Framework_TestCase array(), )); - $definition1 = new Definition(__CLASS__.'_Type1'); - $definition1->addTag('form.type'); - $definition2 = new Definition(__CLASS__.'_Type2'); - $definition2->addTag('form.type'); - $container->setDefinition('form.extension', $extDefinition); - $container->setDefinition('my.type1', $definition1); - $container->setDefinition('my.type2', $definition2); + $container->register('my.type1', __CLASS__.'_Type1')->addTag('form.type'); + $container->register('my.type2', __CLASS__.'_Type2')->addTag('form.type'); $container->compile(); @@ -100,9 +95,10 @@ class FormPassTest extends \PHPUnit_Framework_TestCase } /** - * @group legacy + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage extended-type attribute, none was configured for the "my.type_extension" service */ - public function testAliasOptionForTaggedTypeExtensions() + public function testAddTaggedFormTypeExtensionWithoutExtendedTypeAttribute() { $container = new ContainerBuilder(); $container->addCompilerPass(new FormPass()); @@ -115,23 +111,10 @@ class FormPassTest extends \PHPUnit_Framework_TestCase )); $container->setDefinition('form.extension', $extDefinition); - $container->register('my.type_extension1', 'stdClass') - ->addTag('form.type_extension', array('alias' => 'type1')); - $container->register('my.type_extension2', 'stdClass') - ->addTag('form.type_extension', array('alias' => 'type2')); + $container->register('my.type_extension', 'stdClass') + ->addTag('form.type_extension'); $container->compile(); - - $extDefinition = $container->getDefinition('form.extension'); - - $this->assertSame(array( - 'type1' => array( - 'my.type_extension1', - ), - 'type2' => array( - 'my.type_extension2', - ), - ), $extDefinition->getArgument(2)); } public function testAddTaggedGuessers()