PreUpdate entity symfony LifecycleCallbacks

前端 未结 2 2023
臣服心动
臣服心动 2021-01-26 11:24

I have a little problem with the PreUpdate LifecycleCallbacks in Symfony.

I have an entity User with a OneToMany relation with an entity product.

class U         


        
2条回答
  •  被撕碎了的回忆
    2021-01-26 11:32

    I have got same issue and I have solved it by update $user in preUpdate() then schedule an extra update:

        $args->getEntityManager()->getUnitOfWork()->scheduleExtraUpdate($user, array(
            'field_name' => array($oldValue, $newValue)
        ));
    

提交回复
热议问题