我有这样的倾听者
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()的参数1必须是Doctrine \ Common \ Persistence \ Event \ PreUpdateEventArgs的实例,Doctrine \ ORM \ Event \ PreUpdateEventArgs的实例,
奇怪的是因为我使用了正确的课程 .
1 回答
您正在使用错误的命名空间/类来键入
preUpdate()
函数参数 . 正确 hierarchy 是:Typehint与......
... 要么 ...
... 要么 ...
...但是 NOT :