From a4b49c731e262d899fe71ba70dcf8a710a6297ec Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Wed, 12 May 2021 15:23:32 +0200 Subject: [PATCH] add entity in options on Field --- core/Crud/Field/Field.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/Crud/Field/Field.php b/core/Crud/Field/Field.php index 165951c..2155f84 100644 --- a/core/Crud/Field/Field.php +++ b/core/Crud/Field/Field.php @@ -17,6 +17,7 @@ abstract class Field public function buildView(Environment $twig, $entity, array $options) { return $twig->render($this->getView($options), [ + 'entity' => $entity, 'value' => $this->getValue($entity, $options), 'options' => $options, ]); @@ -53,7 +54,7 @@ abstract class Field } elseif (null !== $options['property_builder']) { $value = call_user_func($options['property_builder'], $entity, $options); } else { - throw new CrudConfigurationException('Unable to get the value. One of "property" and "property_builder" is required.'); + $value = null; } return $value;