DDC-1210: if I call computeAssociationChanges twice it will add this collection twice #1519

Closed
opened 2026-01-22 13:16:45 +01:00 by admin · 5 comments
Owner

Originally created by @doctrinebot on GitHub (Jun 16, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user realmfoo:

For example, if I call computeChangeSets() by myself before calling flush() it will result in errors.

Originally created by @doctrinebot on GitHub (Jun 16, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user realmfoo: For example, if I call computeChangeSets() by myself before calling flush() it will result in errors.
admin added the Bug label 2026-01-22 13:16:45 +01:00
admin closed this issue 2026-01-22 13:16:47 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jun 16, 2011):

Comment created by @beberlei:

The API is marked as internal.

@doctrinebot commented on GitHub (Jun 16, 2011): Comment created by @beberlei: The API is marked as internal.
Author
Owner

@doctrinebot commented on GitHub (Jun 16, 2011):

Comment created by realmfoo:

Method computeChangeSets is not marked as internal (https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/UnitOfWork.php#L500).

If it is then how can I find out was entity changed or not? I need to know it before making other changes (update time, updater name and etc.).

@doctrinebot commented on GitHub (Jun 16, 2011): Comment created by realmfoo: Method computeChangeSets is not marked as internal (https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/UnitOfWork.php#L500). If it is then how can I find out was entity changed or not? I need to know it before making other changes (update time, updater name and etc.).
Author
Owner

@doctrinebot commented on GitHub (Jun 16, 2011):

Comment created by realmfoo:

Another example of using computeAssociationChanges via computeChangeSet described here:
http://www.doctrine-project.org/docs/orm/2.0/en/reference/events.html

So I can't use this example because of the problem with collections. onFlush rises AFTER computeChangeSets and BEFORE any changes, so if I call computeChangeSets inside onFlush event it will break commit (twice insert of equal index).

@doctrinebot commented on GitHub (Jun 16, 2011): Comment created by realmfoo: Another example of using computeAssociationChanges via computeChangeSet described here: http://www.doctrine-project.org/docs/orm/2.0/en/reference/events.html So I can't use this example because of the problem with collections. onFlush rises AFTER computeChangeSets and BEFORE any changes, so if I call computeChangeSets inside onFlush event it will break commit (twice insert of equal index).
Author
Owner

@doctrinebot commented on GitHub (Oct 15, 2011):

Comment created by @beberlei:

The documentation was a bit unclear about this.

The computeChangeSet API is internal. Its only allowed to be called for new entities after they have been persisted inside the onFlush.

You can use "getEntityChangeSet()" inside preUpdate for example to get all the changes that are done.

@doctrinebot commented on GitHub (Oct 15, 2011): Comment created by @beberlei: The documentation was a bit unclear about this. The computeChangeSet API is internal. Its only allowed to be called for new entities after they have been persisted inside the onFlush. You can use "getEntityChangeSet()" inside preUpdate for example to get all the changes that are done.
Author
Owner

@doctrinebot commented on GitHub (Oct 15, 2011):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Oct 15, 2011): 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#1519