Closed vv12131415 closed 3 years ago
We could do something like
foreach ($getters as $getter) {
if (\is_callable($getter)) {
return $getter($object, ...$parameters);
elseif (\is_string($getter)) {
if (method_exists($object, $getter) && \is_callable([$object, $getter])) {
$this->cacheFieldGetter($object, $fieldName, 'getter', $getter);
return $object->{$getter}(...$parameters);
}
} else {
throw exception() // We support only callable and string
}
}
Do you want to do the PR @vladyslavstartsev ?
Yes, weekends
Feature Request
I have a case, when I want to check if user has referrals. Referrals is a doctrine collection. What I need to display is if user has or has no referrals. Currently what I can do is https://symfony.com/doc/current/bundles/SonataAdminBundle/reference/action_list.html#displaying-a-non-model-field
But when I want to do this without changing query I would like to get something like this
this way building admin panel becomes faster
Currently for the feature I want to have I see
sonata-project/admin-bundle/src/Admin/BaseFieldDescription.php (line 393) (my current version is 3.83)