Consider next steps in Symfony application:
postFlush event that dump results of getScheduledEntityInsertions() of Unit of Work.persist and flush methods with previously created entity instancepostFlush listener firedgetScheduledEntityInsertions() call return nothingExpected behaviour is that at last step I see a list of inserted entities, but if you look at executeInserts() method of UoF, unset($this->entityInsertions[$oid]) called for each entity so nothig is returned from getScheduledEntityInsertions() call.
Iam found declined patch for that case: https://github.com/doctrine/doctrine2/pull/5674 and Ocramius suggestion to use "onFlush" event to collect all needed data and fired custom event: https://groups.google.com/forum/#!topic/doctrine-user/GLJEx0p5kL4
But, I dont understand, how it can be done: if I register custom listener for myCustomEvent and fire it from onFlush with list of not inserted entities - it will be executed before entities actually saved to database (postFlush fired) and cant be received from database in this listener.
One of possible solutions is to use one Listener class for onFlush and postFlush event, and in onFlush populate internal property with necessary data, in postFlush read data from property. But this solution has limitations: both listener-methods must be defined same class; listener is not thread-safe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With