From 01ad7671bc73e1f48a0338b31b255cabaa6ee340 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 8 Sep 2015 08:32:52 +0200 Subject: [PATCH] compatibility with older Form component versions --- .../Bundle/FrameworkBundle/Controller/Controller.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php b/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php index 743ae83a71..f2ed17c2ab 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php @@ -260,7 +260,16 @@ class Controller extends ContainerAware */ public function createFormBuilder($data = null, array $options = array()) { - return $this->container->get('form.factory')->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', $data, $options); + 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); } /**