开发者

Delete ACL when deleting an entity in Symfony2

Following this entry in the cookbo开发者_StackOverflow社区ok, the ACL system is easy to implement for an entity: http://symfony.com/doc/current/cookbook/security/acl.html

Ok, now let's say that I delete the entity (I mean, a row of my database). Why are ACL still there? How could I delete its related ACL to maintain my database clean?


After research, I have found a clean solution that works:

$aclProvider = $this->get('security.acl.provider');
$objectIdentity = ObjectIdentity::fromDomainObject($entity);
$aclProvider->deleteAcl($objectIdentity);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜