Skip to content

Commit

Permalink
fix #246 + BC layer for SF < 2.7 (#289)
Browse files Browse the repository at this point in the history
* fix #246

* BC for SF < 2.7 for fix #246

* apply diff
  • Loading branch information
LanmanGroup authored and jordisala1991 committed Mar 12, 2018
1 parent 20a514c commit dfed604
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Form/Type/TranslatedEntityType.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ public function setRequest(Request $request = null)
*/
public function configureOptions(OptionsResolver $resolver)
{
// BC for SF < 2.7
$optionProperty = 'choice_label';
if (in_array('property', $resolver->getDefinedOptions())) {
$optionProperty = 'property';
}

$resolver->setDefaults([
'translation_path' => 'translations',
'translation_property' => null,
Expand All @@ -45,7 +51,7 @@ public function configureOptions(OptionsResolver $resolver)
->select('e, t')
->join('e.translations', 't');
},
'property' => function (Options $options) {
$optionProperty => function (Options $options) {
if (null === $this->request) {
throw new \Exception('Error while getting request');
}
Expand Down

0 comments on commit dfed604

Please sign in to comment.