在创建Doctrine postPersistEventListener 之后的Symfony中,我的IDE指向该$args->getEntity()行; 由于被弃用,我不知道如何解决这个问题,因为它与版本2.8的Symfony文档中的代码相同
IDE PhpStorm的屏幕截图:https://image.prntscr.com/image/tT4zAlXkQMOxqvo6TLblUg.png
码:
public function postPersist(LifecycleEventArgs $args)
{
$entity = $args->getEntity();
// ...
}
Run Code Online (Sandbox Code Playgroud)