diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php
index 2074946cf043..cc0c218e4941 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php
@@ -33,20 +33,14 @@ public function process(ContainerBuilder $container)
// Builds an array with service IDs as keys and tag aliases as values
$types = array();
- // Remember which names will not be supported in Symfony 3.0 to trigger
- // deprecation errors
- $legacyNames = array();
-
foreach ($container->findTaggedServiceIds('form.type') as $serviceId => $tag) {
// The following if-else block is deprecated and will be removed
// in Symfony 3.0
- // Deprecation errors are triggered in DependencyInjectionExtension
+ // Deprecation errors are triggered in the form registry
if (isset($tag[0]['alias'])) {
$types[$tag[0]['alias']] = $serviceId;
- $legacyNames[$tag[0]['alias']] = true;
} else {
$types[$serviceId] = $serviceId;
- $legacyNames[$serviceId] = true;
}
// Support type access by FQCN
@@ -55,7 +49,6 @@ public function process(ContainerBuilder $container)
}
$definition->replaceArgument(1, $types);
- $definition->replaceArgument(4, $legacyNames);
$typeExtensions = array();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml
index 5f12f57c1eb7..57611435ebc4 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml
@@ -46,8 +46,6 @@
-
-
@@ -157,7 +155,7 @@
-
+
@@ -171,14 +169,14 @@
-
+
-
+
-
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_csrf.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_csrf.xml
index f20552ed1822..a78a125940aa 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_csrf.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_csrf.xml
@@ -10,7 +10,7 @@
-
+
%form.type_extension.csrf.enabled%
%form.type_extension.csrf.field_name%
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_debug.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_debug.xml
index 1e8e3c89834d..ddf0a4e32cfe 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_debug.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_debug.xml
@@ -21,7 +21,7 @@
-
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php
index 8318cf6f6492..d7dc9d8a347d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php
@@ -43,7 +43,6 @@ public function testAddTaggedTypes()
array(),
array(),
array(),
- array(),
));
$definition1 = new Definition(__CLASS__.'_Type1');
@@ -80,7 +79,6 @@ public function testUseCustomAliasIfSet()
array(),
array(),
array(),
- array(),
));
$definition1 = new Definition(__CLASS__.'_Type1');
@@ -104,41 +102,6 @@ public function testUseCustomAliasIfSet()
), $extDefinition->getArgument(1));
}
- public function testPassLegacyNames()
- {
- $container = new ContainerBuilder();
- $container->addCompilerPass(new FormPass());
-
- $extDefinition = new Definition('Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension');
- $extDefinition->setArguments(array(
- new Reference('service_container'),
- array(),
- array(),
- array(),
- array(),
- ));
-
- $definition1 = new Definition(__CLASS__.'_Type1');
- $definition1->addTag('form.type');
- $definition2 = new Definition(__CLASS__.'_Type2');
- $definition2->addTag('form.type', array('alias' => 'mytype2'));
-
- $container->setDefinition('form.extension', $extDefinition);
- $container->setDefinition('my.type1', $definition1);
- $container->setDefinition('my.type2', $definition2);
-
- $container->compile();
-
- $extDefinition = $container->getDefinition('form.extension');
-
- $this->assertEquals(array(
- // Service ID if no alias is set
- 'my.type1' => true,
- // Alias if set
- 'mytype2' => true,
- ), $extDefinition->getArgument(4));
- }
-
public function testAddTaggedTypeExtensions()
{
$container = new ContainerBuilder();
@@ -150,7 +113,6 @@ public function testAddTaggedTypeExtensions()
array(),
array(),
array(),
- array(),
));
$definition1 = new Definition('stdClass');
@@ -191,7 +153,6 @@ public function testAddTaggedGuessers()
array(),
array(),
array(),
- array(),
));
$definition1 = new Definition('stdClass');
diff --git a/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php b/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php
index 2c3730c46d8e..487a9aa8b75e 100644
--- a/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php
+++ b/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php
@@ -22,19 +22,17 @@ class DependencyInjectionExtension implements FormExtensionInterface
private $typeServiceIds;
private $typeExtensionServiceIds;
private $guesserServiceIds;
- private $legacyNames;
private $guesser;
private $guesserLoaded = false;
public function __construct(ContainerInterface $container,
array $typeServiceIds, array $typeExtensionServiceIds,
- array $guesserServiceIds, array $legacyNames = array())
+ array $guesserServiceIds)
{
$this->container = $container;
$this->typeServiceIds = $typeServiceIds;
$this->typeExtensionServiceIds = $typeExtensionServiceIds;
$this->guesserServiceIds = $guesserServiceIds;
- $this->legacyNames = $legacyNames;
}
public function getType($name)
@@ -43,14 +41,10 @@ public function getType($name)
throw new InvalidArgumentException(sprintf('The field type "%s" is not registered with the service container.', $name));
}
- if (isset($this->legacyNames[$name])) {
- @trigger_error('Accessing form types by type name/service ID is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
- }
-
$type = $this->container->get($this->typeServiceIds[$name]);
// BC: validate result of getName() for legacy names (non-FQCN)
- if (isset($this->legacyNames[$name]) && $type->getName() !== $name) {
+ if ($name !== get_class($type) && $type->getName() !== $name) {
throw new InvalidArgumentException(
sprintf('The type name specified for the service "%s" does not match the actual name. Expected "%s", given "%s"',
$this->typeServiceIds[$name],
@@ -65,23 +59,11 @@ public function getType($name)
public function hasType($name)
{
- if (isset($this->typeServiceIds[$name])) {
- if (isset($this->legacyNames[$name])) {
- @trigger_error('Accessing form types by type name/service ID is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
- }
-
- return true;
- }
-
- return false;
+ return isset($this->typeServiceIds[$name]);
}
public function getTypeExtensions($name)
{
- if (isset($this->legacyNames[$name])) {
- @trigger_error('Accessing form types by type name/service ID is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
- }
-
$extensions = array();
if (isset($this->typeExtensionServiceIds[$name])) {
@@ -95,10 +77,6 @@ public function getTypeExtensions($name)
public function hasTypeExtensions($name)
{
- if (isset($this->legacyNames[$name])) {
- @trigger_error('Accessing form types by type name/service ID is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
- }
-
return isset($this->typeExtensionServiceIds[$name]);
}