bug #15721 [FrameworkBundle] compatibility with older Form component versions (xabbuh)
This PR was merged into the 2.8 branch.
Discussion
----------
[FrameworkBundle] compatibility with older Form component versions
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #15711
| License | MIT
| Doc PR |
Commits
-------
01ad767
compatibility with older Form component versions
This commit is contained in:
commit
693af63d65
@ -292,7 +292,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user