Ilie Gurzun
Ilie Gurzun

Reputation: 61

Doctrine2 PostFlush event listener for new entities

I have an event listener which should catch the entities that are new created, and make some extra processing to them. Can someone tell me how can I catch the flushed entities in the "PostFlush" event? because I need their ids, and I can't get them in other event. I have tried to get them from the UnitOfWork with the "getScheduledEntityInsertions" function, but there are no entities.

Thank you.

Upvotes: 1

Views: 886

Answers (1)

Fabien MEYNARD
Fabien MEYNARD

Reputation: 597

There is no event related to "postFlush". According to your description, you can use "postPersist" event.

 * The postPersist event occurs for an document after the document has 
 * been made persistent. It will be invoked after the database insert operations.
 * Generated primary key values are available in the postPersist event.

Upvotes: 1

Related Questions