Doctrine 1
  1. Doctrine 1
  2. DC-635

synchronizeWithArray and link-table

    Details

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

      Description

      Tree tables : tags, compo_show_tag, shows

      "compo_show_tag" make a link between tags and shows. It's a many-to-many relationship.

      Assume that all the Tags / Shows are already create. The max id is 300 for shows and tags.

      $itemArray = array ();
      $itemArray["_identifier"] = 38;
      $itemArray["shows"][0]["_identifier"] = 36;
      $itemArray["shows"][1]["_identifier"] = 200;

      $item = new Model_Tag ();
      $item->synchronizeWithArray($itemArray, true);

      echo $item->shows[0]->idShow; //Output : 36
      echo $item->shows[1]->idShow; //Output : 200

      $item->save ();

      Above create two entry into the compo_show_table. Because all element are existing.

      $itemArray = array ();
      $itemArray["_identifier"] = 38;
      $itemArray["shows"][0]["_identifier"] = 36;

      $item = new Model_Tag ();
      $item->synchronizeWithArray($itemArray, true);

      echo $item->shows[0]->idShow; //Output : 36

      $item->save ();

      Above remove the relation between Show#200 and Tag#38, but keep the relation between Show#36 and Tag#38.

      $itemArray = array ();
      $itemArray["_identifier"] = 38;
      $itemArray["shows"][0]["_identifier"] = 36;
      $itemArray["shows"][1]["_identifier"] = 150;
      $item = new Model_Tag ();
      $item->synchronizeWithArray($itemArray, true);

      echo $item->shows[0]->idShow; //Output : 36
      echo $item->shows[1]->idShow; //Output : 150

      $item->save ();

      Above create a new relation, like the first example.

      $itemArray = array ();
      $itemArray["_identifier"] = 38;
      $itemArray["shows"][0]["_identifier"] = 36;
      $itemArray["shows"][1]["_identifier"] = 140;

      $item = new Model_Tag ();
      $item->synchronizeWithArray($itemArray, true);

      echo $item->shows[0]->idShow; //Output : 36
      echo $item->shows[1]->idShow; //Output : 140

      $item->save ();

      Bug is above.
      We except that Doctrine remove the relation between Show#150 and Tag#38 and add a new one between Show#140 and Tag#38.
      Here the bug because Doctrine doesn't change anything.

      Thanks.
      Armetiz.

        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: