DDC-2829: Retrieve fieldName from PersistentCollection #3533

Closed
opened 2026-01-22 14:21:44 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Nov 30, 2013).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user raziel057:

Hi,

I use a custom listener based on the one of Knp DoctrineBehavior: https://github.com/KnpLabs/DoctrineBehaviors/blob/master/src/Knp/DoctrineBehaviors/ORM/Loggable/LoggableListener.php and I would like to use $uow->getScheduledCollectionDeletions() and $uow->getScheduledCollectionUpdates() to add the modifications from manyToMany relations. (like described here: https://groups.google.com/forum/#!topic/doctrine-user/ONDh5H4hMYQ).

So I itereate on the returned array to get a PersistentCollection from which I'm able to call:

$col->getOwner() : to retrieve the owning entity (the entity at the owning side of the association).

$col->getDeleteDiff() : to retrieve the entities that will be removed from the collection.

$col->getInsertDiff() : to retrieve the entities that will be added to the collection.

$col->getSnapshot() : to retrieve the last snapshot.

$col->toArray() : to retrieve the current entities in the collection.

That's good, and I can get all information about the association mapping but I can't retrieve the fieldName.

I think it could be easily added when initializing the PersistentCollection by adding fieldName in the $assoc parameter before to call setOwner() ?

See http://www.doctrine-project.org/api/orm/2.4/source-class-Doctrine.ORM.UnitOfWork.html#_computeChangeSet

Originally created by @doctrinebot on GitHub (Nov 30, 2013). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user raziel057: Hi, I use a custom listener based on the one of Knp DoctrineBehavior: https://github.com/KnpLabs/DoctrineBehaviors/blob/master/src/Knp/DoctrineBehaviors/ORM/Loggable/LoggableListener.php and I would like to use $uow->getScheduledCollectionDeletions() and $uow->getScheduledCollectionUpdates() to add the modifications from manyToMany relations. (like described here: https://groups.google.com/forum/#!topic/doctrine-user/ONDh5H4hMYQ). So I itereate on the returned array to get a PersistentCollection from which I'm able to call: $col->getOwner() : to retrieve the owning entity (the entity at the owning side of the association). $col->getDeleteDiff() : to retrieve the entities that will be removed from the collection. $col->getInsertDiff() : to retrieve the entities that will be added to the collection. $col->getSnapshot() : to retrieve the last snapshot. $col->toArray() : to retrieve the current entities in the collection. That's good, and I can get all information about the association mapping but I can't retrieve the fieldName. I think it could be easily added when initializing the PersistentCollection by adding fieldName in the $assoc parameter before to call setOwner() ? See http://www.doctrine-project.org/api/orm/2.4/source-class-Doctrine.ORM.UnitOfWork.html#_computeChangeSet
admin added the Improvement label 2026-01-22 14:21:44 +01:00
admin closed this issue 2026-01-22 14:21:44 +01:00
Author
Owner

@doctrinebot commented on GitHub (Dec 2, 2013):

Comment created by raziel057:

In fact it's already possible by getting fieldName on after clling $col->getMapping();

@doctrinebot commented on GitHub (Dec 2, 2013): Comment created by raziel057: In fact it's already possible by getting fieldName on after clling $col->getMapping();
Author
Owner

@doctrinebot commented on GitHub (Dec 2, 2013):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Dec 2, 2013): Issue was closed with resolution "Invalid"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3533