Doctrine subscriber that uses the Doctrine onFlush event to update the order attribute's pickwareLastChanged property whenever the order is updated.
Since we have to update the timestamp whenever Order is updated, but need to make the actual change in Order's Attribute (which is not configured to cascade updates to Order), using preUpdate doesn't work. Also, we cannot use postPersist and postUpdate either, because we cannot safely call $em->flush() in those callbacks.
The only viable (and correct) approach to do this is to make the necessary changes in onFlush and then update the unit of work accordingly so the Attribute always gets flushed along with the Order.
see | |
---|---|
package |
Default |
getSubscribedEvents() : array
array
onFlush(\Doctrine\ORM\Event\OnFlushEventArgs $eventArgs)
\Doctrine\ORM\Event\OnFlushEventArgs