Details

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

      Description

      Retreive an object "A" and some related object from the database.
      Export it into an array.
      Create an other instance of "A" and import array from the previous exported array.
      Just save the new instance.

      Doctrine re-create the object into DB. If you have some integrity constraint like primary key, you will see an SQL error.

      In the following example with "video" and "tags", Doctrine want to re-create the video and tag objects.
      The reason is that the exported array doesn't include the "_identifier" key.

      In my mind, the problem show and other problem, that we are force to use the "identifier" or assignIdentifier on the Model domain object to work with an existing object.
      Doctrine know the Primary key of all the model domain objects. Why Doctrine doesn't use the assignIdentifier when the user change the PK of the Model domain object... In this case, assignIdentifier could be into a private scope.

      $oVideo = Doctrine_Query::create ()
      ->select ("video., tags.")
      ->from ("Model_Video video")
      ->leftJoin ("video.tags tags")
      ->where ("video.id_show = 500")
      ->fetchOne ();
      $oVideoArray = $oVideo->toArray();
      $oVideo->save ();

      $oVideoBis = new Model_Video ();
      $oVideoBis->fromArray($oVideoArray, true);
      $oVideoArrayBis = $oVideo->toArray();
      $oVideoBis->save ();

        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: