在调用持久化时始终触发的Doctrine 2生命周期事件

Is there a Doctrine 2 lifecycle event I can subscribe that will always fire any time I call persist() and flush() on an entity.

I am looking to generate a cache file based on an entity any time a user 'saves' that entity, regardless of whether or not Doctrine will actually issue an SQL update statement.

The workaround I'm considering is to add an extra field that's always out of sync with the database to force a persist/update, but I'd prefer an event that is always called.

BTW:

  • The code that performs the persist of the entity is within a third party bundle and I'd rather not hack it if I can avoid that.