Finding out what changed via postUpdate listener in Symfony 2.1

后端 未结 4 1766
萌比男神i
萌比男神i 2021-02-20 18:14

I have a postUpdate listener and I\'d like to know what the values were prior to the update and what the values for the DB entry were after the update. Is there a way to do this

4条回答
  •  [愿得一人]
    2021-02-20 18:53

    You can use this ansfer Symfony2 - Doctrine - no changeset in post update

    /**
     * @param LifecycleEventArgs $args
     */
    public function postUpdate(LifecycleEventArgs $args)
    {
        $changeArray = $args->getEntityManager()->getUnitOfWork()->getEntityChangeSet($args->getObject());
    }
    

提交回复
热议问题