0

我的项目有问题:

Not called :

public function postRemove(LifecycleEventArgs $event)
{
    $test = 1;
    $test1 = 2;
}

Called :

public function preRemove(LifecycleEventArgs $event)
{
    $test = 1;
    $test1 = 2;
}

奇怪的是 postRemove 没有被调用。我确认该实体已从数据库中删除。请给出一个想法。

4

1 回答 1

0
public function getSubscribedEvents()
{
    return array(
        'postPersist',
        'postUpdate',
        'postRemove' // !!! 
    );
}

public function postUpdate(LifecycleEventArgs $args)
{
    dump('Update');
}

public function postPersist(LifecycleEventArgs $args)
{
    dump('Persist');
}


public function postRemove(LifecycleEventArgs $args)
{
    dump('Remove');
}
于 2018-08-16T08:03:00.473 回答