Skip to content

Commit 06b5665

Browse files
committed
Symfony 3.x compatibility
1 parent e4823ca commit 06b5665

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

bundle/Form/Builder/FormBuilder.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
namespace Netgen\Bundle\InformationCollectionBundle\Form\Builder;
44

5+
use Netgen\Bundle\EzFormsBundle\Form\Type\InformationCollectionType;
56
use Symfony\Component\Form\FormBuilderInterface;
67
use Symfony\Component\Form\FormFactoryInterface;
8+
use Symfony\Component\HttpKernel\Kernel;
79
use Symfony\Component\Routing\RouterInterface;
810
use eZ\Publish\API\Repository\Values\Content\Location;
911
use eZ\Publish\API\Repository\ContentTypeService;
@@ -12,8 +14,6 @@
1214

1315
class FormBuilder
1416
{
15-
const EZFORMS_INFORMATION_COLLECTION = 'ezforms_information_collection';
16-
1717
/**
1818
* @var FormFactoryInterface
1919
*/
@@ -48,7 +48,6 @@ public function __construct(
4848
RouterInterface $router,
4949
$useCsrf
5050
) {
51-
5251
$this->formFactory = $formFactory;
5352
$this->useCsrf = $useCsrf;
5453
$this->contentTypeService = $contentTypeService;
@@ -73,7 +72,9 @@ public function createFormForLocation(Location $location, $useAjax = false)
7372

7473
$formBuilder = $this->formFactory
7574
->createBuilder(
76-
self::EZFORMS_INFORMATION_COLLECTION,
75+
Kernel::VERSION_ID < 20800 ?
76+
'ezforms_information_collection' :
77+
InformationCollectionType::class,
7778
$data,
7879
[
7980
'csrf_protection' => $this->useCsrf,

0 commit comments

Comments
 (0)