10000 [3.0][FrameworkBundle] Removed deprecated features · symfony/symfony@fc41cf0 · GitHub
[go: up one dir, main page]

Skip to content

Commit fc41cf0

Browse files
wouterjfabpot
authored andcommitted
[3.0][FrameworkBundle] Removed deprecated features
1 parent 3832bec commit fc41cf0

File tree

6 files changed

+8
-73
lines changed

6 files changed

+8
-73
lines changed

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
3.0.0
5+
-----
6+
7+
* removed `validator.api` parameter
8+
* removed `alias` option of the `form.type` tag
9+
410
2.8.0
511
-----
612

src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Symfony\Component\HttpKernel\HttpKernelInterface;
2121
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
2222
use Symfony\Component\Security\Csrf\CsrfToken;
23+
use Symfony\Component\Form\Extension\Core\Type\FormType;
2324
use Symfony\Component\Form\FormTypeInterface;
2425
use Symfony\Component\Form\Form;
2526
use Symfony\Component\Form\FormBuilder;
@@ -292,16 +293,7 @@ protected function createForm($type, $data = null, array $options = array())
292293
*/
293294
protected function createFormBuilder($data = null, array $options = array())
294295
{
295-
if (method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix')) {
296-
$type = 'Symfony\Component\Form\Extension\Core\Type\FormType';
297-
} else {
298-
// not using the class name is deprecated since Symfony 2.8 and
299-
// is only used for backwards compatibility with older versions
300-
// of the Form component
301-
$type = 'form';
302-
}
303-
304-
return $this->container->get('form.factory')->createBuilder($type, $data, $options);
296+
return $this->container->get('form.factory')->createBuilder(FormType::class, $data, $options);
305297
}
306298

307299
/**

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@ public function process(ContainerBuilder $container)
3434
$types = array();
3535

3636
foreach ($container->findTaggedServiceIds('form.type') as $serviceId => $tag) {
37-
// The following if-else block is deprecated and will be removed
38-
// in Symfony 3.0
39-
// Deprecation errors are triggered in the form registry
40-
if (isset($tag[0]['alias'])) {
41-
$types[$tag[0]['alias']] = $serviceId;
42-
} else {
43-
$types[$serviceId] = $serviceId;
44-
}
45-
4637
// Support type access by FQCN
4738
$serviceDefinition = $container->getDefinition($serviceId);
4839
$types[$serviceDefinition->getClass()] = $serviceId;

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -777,12 +777,6 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
777777

778778
$validatorBuilder->addMethodCall('setMetadataCache', array(new Reference($config['cache'])));
779779
}
780-
781-
// You can use this parameter to check the API version in your own
782-
// bundle extension classes
783-
// This is set to 2.5-bc for compatibility with Symfony 2.5 and 2.6.
784-
// @deprecated since version 2.7, to be removed in 3.0
785-
$container->setParameter('validator.api', '2.5-bc');
786780
}
787781

788782
private function getValidatorMappingFiles(ContainerBuilder $container)

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@
77

88
<xsd:element name="config" type="config" />
99

10-
<xsd:simpleType name="validator_api_version">
11-
<xsd:restriction base="xsd:string">
12-
<xsd:enumeration value="auto" />
13-
<xsd:enumeration value="2.4" />
14-
<xsd:enumeration value="2.5" />
15-
<xsd:enumeration value="2.5-bc" />
16-
</xsd:restriction>
17-
</xsd:simpleType>
18-
1910
<xsd:complexType name="config">
2011
<xsd:all>
2112
<xsd:element name="assets" type="assets" minOccurs="0" maxOccurs="1" />
@@ -180,7 +171,6 @@
180171
<xsd:attribute name="cache" type="xsd:string" />
181172
<xsd:attribute name="enable-annotations" type="xsd:boolean" />
182173
<xsd:attribute name="static-method" type="xsd:boolean" />
183-
<xsd:attribute name="api" type="validator_api_version" />
184174
</xsd:complexType>
185175

186176
<xsd:complexType name="annotations">

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -59,46 +59,8 @@ public function testAddTaggedTypes()
5959
$extDefinition = $container->getDefinition('form.extension');
6060

6161
$this->assertEquals(array(
62-
// As of Symfony 2.8, the class is used to look up types
6362
__CLASS__.'_Type1' => 'my.type1',
6463
__CLASS__.'_Type2' => 'my.type2',
65-
// Before Symfony 2.8, the service ID was used as default alias
66-
'my.type1' => 'my.type1',
67-
'my.type2' => 'my.type2',
68-
), $extDefinition->getArgument(1));
69-
}
70-
71-
public function testUseCustomAliasIfSet()
72-
{
73-
$container = new ContainerBuilder();
74-
$container->addCompilerPass(new FormPass());
75-
76-
$extDefinition = new Definition('Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension');
77-
$extDefinition->setArguments(array(
78-
new Reference('service_container'),
79-
array(),
80-
array(),
81-
array(),
82-
));
83-
84-
$definition1 = new Definition(__CLASS__.'_Type1');
85-
$definition1->addTag('form.type', array('alias' => 'mytype1'));
86-
$definition2 = new Definition(__CLASS__.'_Type2');
87-
$definition2->addTag('form.type', array('alias' => 'mytype2'));
88-
89-
$container->setDefinition('form.extension', $extDefinition);
90-
$container->setDefinition('my.type1', $definition1);
91-
$container->setDefinition('my.type2', $definition2);
92-
93-
$container->compile();
94-
95-
$extDefinition = $container->getDefinition('form.extension');
96-
97-
$this->assertEquals(array(
98-
__CLASS__.'_Type1' => 'my.type1',
99-
__CLASS__.'_Type2' => 'my.type2',
100-
'mytype1' => 'my.type1',
101-
'mytype2' => 'my.type2',
10264
), $extDefinition->getArgument(1));
10365
}
10466

0 commit comments

Comments
 (0)
0