Skip to content

Commit 7b46369

Browse files
committed
Fixing getParent method for 2.8 version compatibility.
1 parent 7614dfc commit 7b46369

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Form/Type/ExpandedMTMType.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use abdielcs\ExpandedCollectionBundle\Form\DataTransformer\MiddleClassTransformer;
1515
use Symfony\Component\Form\AbstractType;
1616
use Symfony\Component\Form\FormBuilderInterface;
17-
use Symfony\Component\HttpKernel\Kernel;
1817
use Symfony\Component\OptionsResolver\OptionsResolver;
1918
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
2019

@@ -36,8 +35,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
3635

3736
public function getParent()
3837
{
39-
if (Kernel::MAJOR_VERSION > 2) {
40-
return ExpandedOTMType::class ;
38+
if (method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix')) {
39+
return ExpandedOTMType::class;
4140
} else {
4241
return 'expanded_otm';
4342
}

Form/Type/ExpandedOTMType.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Symfony\Component\Form\AbstractType;
1616
use Symfony\Component\Form\FormInterface;
1717
use Symfony\Component\Form\FormView;
18-
use Symfony\Component\HttpKernel\Kernel;
1918
use Symfony\Component\OptionsResolver\OptionsResolver;
2019
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
2120

@@ -28,7 +27,7 @@ class ExpandedOTMType extends AbstractType
2827
{
2928
public function getParent()
3029
{
31-
if (Kernel::MAJOR_VERSION > 2) {
30+
if (method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix')) {
3231
return EntityType::class;
3332
} else {
3433
return 'entity';

0 commit comments

Comments
 (0)