我有一个这样的监听器。
use Doctrine\Common\EventSubscriber;
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
use Doctrine\Common\Persistence\Event\PreUpdateEventArgs;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\Events;
class MachineSubscriber implements EventSubscriber
和方法
/**
* @param PreUpdateEventArgs $args
*/
public function preUpdate(PreUpdateEventArgs $args)
并且Doctrine抛出异常
ContextErrorException: 可捕获的致命错误:传递给 Certificate\MachineBundle\Event\MachineSubscriber::preUpdate() 的第一个参数必须是 Doctrine\Common\Persistence\Event\PreUpdateEventArgs 的实例,但给定了 Doctrine\ORM\Event\PreUpdateEventArgs 的实例。
很奇怪,因为我使用了正确的类。