Doctrine 1
  1. Doctrine 1
  2. DC-643

Doctrine_Collection problem duplicate record

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      $oVideo = Doctrine_Core::getTable ("Model_Video")->find (500);
      $oVideo = new Model_Video ();
      $oVideo->assignIdentifier (500);

      $oTag = Doctrine_Core::getTable ("Model_Tag")->find (500);
      $oVideo->tags->clear ();
      $oVideo->tags[] = $oTag;
      $oVideo->save ();

      The previous code can be execute a lot of time.

      Now, let us create the Doctrine_Collection.

      $oVideo = Doctrine_Core::getTable ("Model_Video")->find (500);
      $oVideo = new Model_Video ();
      $oVideo->assignIdentifier (500);

      $oTag = Doctrine_Core::getTable ("Model_Tag")->find (500);
      $oVideo->tags = new Doctrine_Collection ("Model_Tag");
      $oVideo->tags[] = $oTag;
      $oVideo->save ();

      Doctrine create a relation between the video and tag. It doesn't update it.
      If the relation already exists into the database, Doctrine create an other record, or the DB throw an integrity error if you have constraint.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Thomas Tourlourat - Armetiz
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: