compatibility with older Form component versions

This commit is contained in:
Christian Flothmann 2015-09-08 08:32:52 +02:00
parent a8c3b234a7
commit 01ad7671bc

View File

@ -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);
}
/**