|
@@ -15,6 +15,7 @@ use Doctrine\Common\Util\ClassUtils;
|
|
|
use Symfony\Component\PropertyAccess\PropertyAccess;
|
|
|
use Symfony\Component\PropertyAccess\PropertyPath;
|
|
|
use Symfony\Component\Form\Exception\InvalidArgumentException;
|
|
|
+use Symfony\Component\Form\Exception\RuntimeException;
|
|
|
use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
|
|
|
use Sonata\AdminBundle\Model\ModelManagerInterface;
|
|
|
|
|
@@ -140,7 +141,7 @@ class ModelChoiceList extends SimpleChoiceList
|
|
|
try {
|
|
|
$value = (string) $entity;
|
|
|
} catch (\Exception $e) {
|
|
|
- throw new StringCastException(sprintf("Unable to convert the entity %s to String, entity must have a '__toString()' method defined", ClassUtils::getClass($entity)));
|
|
|
+ throw new RuntimeException(sprintf("Unable to convert the entity %s to String, entity must have a '__toString()' method defined", ClassUtils::getClass($entity)), 0, $e);
|
|
|
}
|
|
|
}
|
|
|
|