DoctrineStateMachineBundle icon indicating copy to clipboard operation
DoctrineStateMachineBundle copied to clipboard

Dirty Entities

Open rufinus opened this issue 10 years ago • 0 comments

First of all, thanks for a create bundle, saved me a lot of work.

I overwritten the config for StatefulEntitiesCallbacksListener and implemented it by myself. so i can use own classes for post/pre{Name} methods. (Dont wanted them in the Entities)

As it is now i have to insert some other rows depend on the state (right now onInit state, which event i also added to the subscribed events stack)

This is working all very well. The problem is your PersistenceListener is called in the prePersist layer (i know why this is done.. to set the state automaticly) the problem is as i use the onInit event too, the Entity is not persistat/flushed. So i cant persist my own entities which have relations on the stateful - entity. ( A managed+dirty entity [Entity] can not be scheduled for insertion. )

I checked and tried and played around, but i cant find a way to call the FiniteEvents in Doctrines onFlush event.

Do you have any idea how i could overcome this?

See for modified files https://gist.github.com/rufinus/5d754c7cc6a5de336ccc

And http://stackoverflow.com/questions/10374155/doctrine-inserting-in-postpersist-event Any Help would be much appreciated

rufinus avatar May 04 '14 12:05 rufinus