Skip to content

Commit b466760

Browse files
committed
Merge pull request #19 from lemoinem/fix/symfony-3-compatibility
[Symfony3] Fix compatibility
2 parents d7b60f1 + 7abd902 commit b466760

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Form/Type/KeyValueType.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,14 @@ public function configureOptions(OptionsResolver $resolver)
6868
));
6969

7070
$resolver->setRequired(array('value_type'));
71-
$resolver->setAllowedTypes(array('allowed_keys' => array('null', 'array')));
71+
72+
if (method_exists($resolver, 'setDefined')) {
73+
// Symfony 2.6+ API
74+
$resolver->setAllowedTypes('allowed_keys', array('null', 'array'));
75+
} else {
76+
// Symfony <2.6 API
77+
$resolver->setAllowedTypes(array('allowed_keys' => array('null', 'array')));
78+
}
7279
}
7380

7481
public function getParent()

0 commit comments

Comments
 (0)