I have a preUpdate listener in my app. When it is fired I want it to create some additional records. A simplified example of the basic functionality is below. In this current implementation it would appear that the new events are not being persisted. Are there other calls I need to be making here? Thanks.
public function preUpdate(EventLifecycleEventArgs $eventArgs)
{
$em = $eventArgs->getEntityManager();
$uow = $em->getUnitOfWork();
$entity = $eventArgs->getEntity();
$updateArray = $eventArgs->getEntityChangeSet();
//Updates
if (($entity instanceof Bam) === false) {
$thing = new OtherThing();
$thing->setFoo('bar');
$uow->persist($thing);
}
$uow->computeChangeSets();
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…