用于新实体的Doctrine2 PostFlush事件侦听器


Doctrine2 PostFlush event listener for new entities

我有一个事件侦听器,它应该捕获新创建的实体,并对它们进行一些额外的处理。有人能告诉我如何在"PostFlush"事件中捕获刷新的实体吗?因为我需要他们的id,而在其他活动中我无法获得它们。我曾尝试使用"getScheduledEntityInsertions"函数从UnitOfWork获取它们,但没有实体。

谢谢。

没有与"postFlush"相关的事件。根据您的描述,您可以使用"postPersist"事件。

 * 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.