Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1925

Bug in UnitOfWork and ManyToMany relations

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.3
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None
    • Environment:
      symfony2

      Description

      Lets say, I have entity Forum with ManyToMany relations with User.
      I need to validate user changes and I use code like

      $uow = $this->getDoctrine()>getEntityManager()>getUnitOfWork();
      $uow->computeChangeSets();
      $changeSet = $uow->getEntityChangeSet($forum);
      if (.... bla-bla-bla....)

      { $em = $this->getDoctrine()->getEntityManager(); $em->persist($forum); $em->flush(); }

      Unfortunately, whenever I try to change manyToMany relations - I got error
      SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4-4' for key 'PRIMARY'

      If I comment uow code - everything works just great.

      It looks like bug in UnitOfWork implementation.

      Let me know if you need more details from me.

        Activity

        Hide
        Doctrine Bot added a comment -

        A related Github Pull-Request [GH-403] was closed:
        https://github.com/doctrine/dbal/pull/403

        Show
        Doctrine Bot added a comment - A related Github Pull-Request [GH-403] was closed: https://github.com/doctrine/dbal/pull/403
        Hide
        Doctrine Bot added a comment -

        A related Github Pull-Request [GH-402] was closed:
        https://github.com/doctrine/dbal/pull/402

        Show
        Doctrine Bot added a comment - A related Github Pull-Request [GH-402] was closed: https://github.com/doctrine/dbal/pull/402
        Hide
        Benjamin Eberlei added a comment -

        A related Github Pull-Request [GH-402] was closed
        https://github.com/doctrine/doctrine2/pull/402

        Show
        Benjamin Eberlei added a comment - A related Github Pull-Request [GH-402] was closed https://github.com/doctrine/doctrine2/pull/402
        Hide
        Benjamin Eberlei added a comment -

        A related Github Pull-Request [GH-403] was closed
        https://github.com/doctrine/doctrine2/pull/403

        Show
        Benjamin Eberlei added a comment - A related Github Pull-Request [GH-403] was closed https://github.com/doctrine/doctrine2/pull/403
        Hide
        Marco Pivetta added a comment -

        Duplicate of DDC-1210

        Show
        Marco Pivetta added a comment - Duplicate of DDC-1210

          People

          • Assignee:
            Marco Pivetta
            Reporter:
            Andrew
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: