diff --git a/Form/Type/ModelType.php b/Form/Type/ModelType.php index c1c69548..410975bd 100644 --- a/Form/Type/ModelType.php +++ b/Form/Type/ModelType.php @@ -215,7 +215,7 @@ public function configureOptions(OptionsResolver $resolver) /** @var ModelCriteria $query */ $query = $options['query']; - $choiceLabel = function($choice) use ($valueProperty) { + $choiceLabel = function($choice) use ($valueProperty, $query) { $getter = 'get'.ucfirst($valueProperty); if (!method_exists($choice, $getter)) { $getter = 'get' . ucfirst($query->getTableMap()->getColumn($valueProperty)->getPhpName());