EasyAdminBundle
EasyAdminBundle copied to clipboard
FieldDto should be aware about EntityDto to which it is applied.
Short description of what this feature will allow to do: It would be great if FieldDto would be aware about EntityDto
public function processFieldsForAll(EntityCollection $entities, FieldCollection $fields): void
{
foreach ($entities as $entity) {
$this->processFields($entity, clone $fields);
$entities->set($entity);
}
}
EA already doing clone of FieldCollection, so it's a unique set per entity
Example of how to use this feature I'm working on integrating https://github.com/symfony/acl-bundle into my project and want to deny/allow accesses based on ACL object.
In order to do I need to implement custom ObjectIdentityRetrievalStrategy
(acl class) to retrieve "real entity" and not DTO.
class EasyAdminObjectIdentityRetrievalStrategy extends ObjectIdentityRetrievalStrategy
{
public function getObjectIdentity($domainObject)
{
if ($domainObject instanceof EntityDto && $domainObject->getInstance() !== null) {
return parent::getObjectIdentity($domainObject->getInstance());
} elseif ($domainObject instanceof FieldDto && $domainObject->get) {
}
return parent::getObjectIdentity($domainObject);
}
}
but FieldDto
does not have such any association with EntityDto
or entity
itself.