Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1210

if I call computeAssociationChanges twice it will add this collection twice

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: Git Master
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

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

        Activity

        Hide
        Benjamin Eberlei added a comment -

        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.

        Show
        Benjamin Eberlei added a comment - 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.
        Hide
        Konstantin added a comment -

        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).

        Show
        Konstantin added a comment - 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).
        Hide
        Konstantin added a comment -

        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.).

        Show
        Konstantin added a comment - 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.).
        Hide
        Benjamin Eberlei added a comment -

        The API is marked as internal.

        Show
        Benjamin Eberlei added a comment - The API is marked as internal.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Konstantin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: