8000 bug #15721 [FrameworkBundle] compatibility with older Form component … · symfony/symfony@693af63 · GitHub
[go: up one dir, main page]

Skip to content

Commit 693af63

Browse files
committed
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
2 parents 6f7aae9 + 01ad767 commit 693af63

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,16 @@ public function createForm($type, $data = null, array $options = array())
292292
*/
293293
public function createFormBuilder($data = null, array $options = array())
294294
{
295-
return $this->container->get('form.factory')->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', $data, $options);
295+
if (method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix')) {
296+
$type = 'Symfony\Component\Form\Extension\Core\Type\FormType';
297+
} else {
298+
// not using the class name is deprecated since Symfony 2.8 and
299+
// is only used for backwards compatibility with older versions
300+
// of the Form component
301+
$type = 'form';
302+
}
303+
304+
return $this->container->get('form.factory')->createBuilder($type, $data, $options);
296305
}
297306

298307
/**

0 commit comments

Comments
 (0)
0