|
@@ -169,6 +169,10 @@ class EntityChoiceList extends ArrayChoiceList
|
|
|
$value = $this->propertyPath->getValue($entity);
|
|
|
} else {
|
|
|
// Otherwise expect a __toString() method in the entity
|
|
|
+ if (!method_exists($entity, '__toString')) {
|
|
|
+ throw new FormException('Entities passed to the choice field must have a "__toString()" method defined (or you can also override the "property" option).');
|
|
|
+ }
|
|
|
+
|
|
|
$value = (string)$entity;
|
|
|
}
|
|
|
|