2014-08-28 67 views
1

我有一個事件偵聽器,它應該捕獲新創建的實體,並對它們進行一些額外的處理。有人能告訴我如何捕捉「PostFlush」事件中被沖刷的實體嗎?因爲我需要他們的ID,而我無法在其他事件中得到他們。我試圖用「getScheduledEntityInsertions」函數從UnitOfWork中獲取它們,但沒有實體。Doctrine2新實體的PostFlush事件偵聽器

謝謝。

回答

1

沒有與「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.