add entity in options on Field

This commit is contained in:
Simon Vieille 2021-05-12 15:23:32 +02:00
parent 22e2c53e9d
commit a4b49c731e

View file

@ -17,6 +17,7 @@ abstract class Field
public function buildView(Environment $twig, $entity, array $options) public function buildView(Environment $twig, $entity, array $options)
{ {
return $twig->render($this->getView($options), [ return $twig->render($this->getView($options), [
'entity' => $entity,
'value' => $this->getValue($entity, $options), 'value' => $this->getValue($entity, $options),
'options' => $options, 'options' => $options,
]); ]);
@ -53,7 +54,7 @@ abstract class Field
} elseif (null !== $options['property_builder']) { } elseif (null !== $options['property_builder']) {
$value = call_user_func($options['property_builder'], $entity, $options); $value = call_user_func($options['property_builder'], $entity, $options);
} else { } else {
throw new CrudConfigurationException('Unable to get the value. One of "property" and "property_builder" is required.'); $value = null;
} }
return $value; return $value;