Permalink
Browse files

[3.0][FrameworkBundle] Removed deprecated features

  • Loading branch information...
wouterj authored and fabpot committed Sep 26, 2015
1 parent 3832bec commit fc41cf0985d11a94f22cbd71b99168f70652bb04
@@ -1,6 +1,12 @@
CHANGELOG
=========
3.0.0
-----
* removed `validator.api` parameter
* removed `alias` option of the `form.type` tag
2.8.0
-----
@@ -20,6 +20,7 @@
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Csrf\CsrfToken;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormBuilder;
@@ -292,16 +293,7 @@ protected function createForm($type, $data = null, array $options = array())
*/
protected function createFormBuilder($data = null, array $options = array())
{
if (method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix')) {
$type = 'Symfony\Component\Form\Extension\Core\Type\FormType';
} else {
// not using the class name is deprecated since Symfony 2.8 and
// is only used for backwards compatibility with older versions
// of the Form component
$type = 'form';
}
return $this->container->get('form.factory')->createBuilder($type, $data, $options);
return $this->container->get('form.factory')->createBuilder(FormType::class, $data, $options);
}
/**
@@ -34,15 +34,6 @@ public function process(ContainerBuilder $container)
$types = 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 the form registry
if (isset($tag[0]['alias'])) {
$types[$tag[0]['alias']] = $serviceId;
} else {
$types[$serviceId] = $serviceId;
}
// Support type access by FQCN
$serviceDefinition = $container->getDefinition($serviceId);
$types[$serviceDefinition->getClass()] = $serviceId;
@@ -777,12 +777,6 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
$validatorBuilder->addMethodCall('setMetadataCache', array(new Reference($config['cache'])));
}
// You can use this parameter to check the API version in your own
// bundle extension classes
// This is set to 2.5-bc for compatibility with Symfony 2.5 and 2.6.
// @deprecated since version 2.7, to be removed in 3.0
$container->setParameter('validator.api', '2.5-bc');
}
private function getValidatorMappingFiles(ContainerBuilder $container)
@@ -7,15 +7,6 @@
<xsd:element name="config" type="config" />
<xsd:simpleType name="validator_api_version">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="auto" />
<xsd:enumeration value="2.4" />
<xsd:enumeration value="2.5" />
<xsd:enumeration value="2.5-bc" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="config">
<xsd:all>
<xsd:element name="assets" type="assets" minOccurs="0" maxOccurs="1" />
@@ -180,7 +171,6 @@
<xsd:attribute name="cache" type="xsd:string" />
<xsd:attribute name="enable-annotations" type="xsd:boolean" />
<xsd:attribute name="static-method" type="xsd:boolean" />
<xsd:attribute name="api" type="validator_api_version" />
</xsd:complexType>
<xsd:complexType name="annotations">
@@ -59,46 +59,8 @@ public function testAddTaggedTypes()
$extDefinition = $container->getDefinition('form.extension');
$this->assertEquals(array(
// As of Symfony 2.8, the class is used to look up types
__CLASS__.'_Type1' => 'my.type1',
__CLASS__.'_Type2' => 'my.type2',
// Before Symfony 2.8, the service ID was used as default alias
'my.type1' => 'my.type1',
'my.type2' => 'my.type2',
), $extDefinition->getArgument(1));
}
public function testUseCustomAliasIfSet()
{
$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(),
));
$definition1 = new Definition(__CLASS__.'_Type1');
$definition1->addTag('form.type', array('alias' => 'mytype1'));
$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(
__CLASS__.'_Type1' => 'my.type1',
__CLASS__.'_Type2' => 'my.type2',
'mytype1' => 'my.type1',
'mytype2' => 'my.type2',
), $extDefinition->getArgument(1));
}

0 comments on commit fc41cf0

Please sign in to comment.