이 지금 아주 오래된 비슷한 할,하지만 난 생각 마침내 대답은 내 두 센트 드롭 줄 필요를 위해서.
Symfony의 문서에 언급 된 것처럼 실제로 간단합니다. SecurityIdentity를 삭제하면 ACE가 삭제된다는 것을 보장 할 수 있습니다.
그래서 가장 쉬운 방법은 당신의 서비스에 aclProvider을 주입하는 것입니다
<?php
namespace acme\acmeBundle\Listener;
use Symfony\Component\Security\Acl\Dbal\MutableAclProvider,
Symfony\Component\Security\Acl\Domain\UserSecurityIdentity;
use Doctrine\ORM\Event\LifecycleEventArgs;
use acme\acmeBundle\Entity\User;
class UserListener
{
protected $aclProvider;
public function __construct(MutableAclProvider $aclProvider){
$this->aclProvider = $aclProvider;
}
public function postRemove(User $user, LifecycleEventArgs $event) {
$securityId = UserSecurityIdentity::fromAccount($user);
$this->aclProvider->deleteSecurityIdentity($securityId);
}
}
그리고 지금, 당신은 사용자가 삭제 한 SecurityIdentity를을 :
core.services.userListener:
class: acme\acmeBundle\Listener\UserListener
arguments: ["@security.acl.provider"]
tags:
- { name: doctrine.orm.entity_listener, lazy: true }
그런 다음 서비스의 뜻은 다음과 같다
ACE가 연결된 모든 ACE가 제거됩니다.
정확히 내가 말하고있는 게시물이며 잘 청소하지 않는 게시물입니다. 나는 그것을 지금 명백하게했다. – smarber
나는 지금까지는 그 해결책이 없다고 생각하지만, 강력한 프레임 워크에서 작업 할 때 sql 테이블에 액세스하는 것은 다소 "더러운"것입니다 : 'D. – smarber