Open peterrehm opened 8 years ago
http://doctrine-orm.readthedocs.io/projects/doctrine-orm/en/latest/reference/events.html#onflush
OnFlush: It is called inside EntityManager#flush() after the changes to all the managed entities and their associations have been computed.
If you want to change the entity list, you need to let the UoW know (via computeChangeSet, see the link above).
@coudenysj I dont want to do additional changes, the question is why I get the changes of a collection through getScheduledEntityInsertions
instead of getScheduledCollectionUpdates
, same with removals.
I see some months has passed, But I'd like to 'reopen' the problem. I've seen that during the flush (in the "commit" method of the class "UnitOfWork"), if I update some entity and some collections as well (update or remove) I found all the updates in "$this->entityUpdates", while "$this->collectionUpdates" is empty. I checked the documentations and I've configured the associations correctly. Someone has any idea?
I've seen that during the flush (in the "commit" method of the class "UnitOfWork"), if I update some entity and some collections as well (update or remove) I found all the updates in "$this->entityUpdates", while "$this->collectionUpdates" is empty.
Executing any changes to the entities during flush()
execution means that you have to take ownership of these changes, and register them with the UnitOfWork
yourself.
I'm not sure I explained myself correctly. I don't execute changes during flush; what I meant was that, if I execute some changes to entity and collections, and then I flush, all the changes are in 'entityUpdates' and none in 'collectionUpdates
same problem, any news?
all the changes are in
entityUpdates
and none incollectionUpdates
That's clear now, but it needs a test case.
Same problem, since 2017? Uff. Related to https://github.com/doctrine/orm/issues/7365
Same problem, since 2017? Uff.
Here's your time to shine! Submit a PR to fix it! Chop chop, the issue isn't going to fix itself!
I am not sure wether this is intended and I am misunderstanding a concept or wether this might be a bug.
I am havin a One-To-Many relationship between Quotes and QuoteItems and I would like to do some adjustments in a onFlush listener. However if I add an item to an existing quote I di get the item in
$uow->getScheduledEntityInsertions()
but I would have expected to see the changes in$uow->getScheduledCollectionUpdates()
.Is this expected?