From 536c547d82dfa7a15a9d840a1e5d5117eb6c273a Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sat, 26 Sep 2015 11:14:12 +0200 Subject: [PATCH 1/3] Removed usage of the form type name instead of class name --- .../FrameworkBundle/Controller/Controller.php | 12 +----- .../DependencyInjection/Compiler/FormPass.php | 9 ----- .../Compiler/FormPassTest.php | 38 ------------------- 3 files changed, 2 insertions(+), 57 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php b/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php index 68305a2e7bbea..9eced83d4f3c1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php @@ -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); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php index cc0c218e4941b..11b30062fefb6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php @@ -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; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php index d7dc9d8a347da..6a4561f882940 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php @@ -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)); } From cefc31521fb2755a44b69d8c4e41cc1bb371c13a Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sat, 26 Sep 2015 11:17:55 +0200 Subject: [PATCH 2/3] Removed validator api version --- .../DependencyInjection/FrameworkExtension.php | 6 ------ .../Resources/config/schema/symfony-1.0.xsd | 10 ---------- 2 files changed, 16 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index e7f8ea49c0497..3af895e01bfd9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -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) diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index 9dd9802274f23..3f04c38d868a7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -7,15 +7,6 @@ - - - - - - - - - @@ -180,7 +171,6 @@ - From e3718158dd491df6da0341a7ad29d0d302499997 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sat, 26 Sep 2015 11:19:45 +0200 Subject: [PATCH 3/3] Updated CHANGELOG --- src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md index 474637d6eaf09..5e21bcbebb683 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md @@ -1,6 +1,12 @@ CHANGELOG ========= +3.0.0 +----- + + * removed `validator.api` parameter + * removed `alias` option of the `form.type` tag + 2.8.0 ----- pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy