Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1283

Possible issue with PersistentCollection#getDelete/InsertDiff()

    Details

    • Type: Improvement Improvement
    • Status: Reopened
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.1
    • Fix Version/s: 2.5
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      Using the following code, when you go from (1, 2) to (1), (2) is deleted as expected. However, if you go from (1, 2) to (2), (1) and (2) are deleted and (2) is then inserted. Is this the desired behaviour? (i.e. 2 extra queries)

      $bracket->getTournamentLocations()->takeSnapshot();
      
      $col = $bracket->getTournamentLocations()->unwrap();
      
      $col->clear();
      
      foreach ($form->getValue('tournamentLocations') as $id) {
          $col->add($em->getReference('Tournaments_Model_TournamentLocation', $id));
      }
      
      $bracket->getTournamentLocations()->setDirty(true);

        Activity

        Glen Ainscow created issue -
        Glen Ainscow made changes -
        Field Original Value New Value
        Description Using the following code, when you go from (1, 2) to (1), (2) is deleted as expected. However, if you go from (1, 2) to (2), (1) and (2) are deleted and (2) is then inserted. Is this the desired behaviour? (i.e. 2 extra queries)

        {code}$bracket->getTournamentLocations()->takeSnapshot();

                    $col = $bracket->getTournamentLocations()->unwrap();

                    $col->clear();

                    foreach ($form->getValue('tournamentLocations') as $id) {
                        $col->add($em->getReference('Tournaments_Model_TournamentLocation', $id));
                    }

                    $bracket->getTournamentLocations()->setDirty(true);{code}
        Using the following code, when you go from (1, 2) to (1), (2) is deleted as expected. However, if you go from (1, 2) to (2), (1) and (2) are deleted and (2) is then inserted. Is this the desired behaviour? (i.e. 2 extra queries)

        {code}$bracket->getTournamentLocations()->takeSnapshot();

        $col = $bracket->getTournamentLocations()->unwrap();

        $col->clear();

        foreach ($form->getValue('tournamentLocations') as $id) {
            $col->add($em->getReference('Tournaments_Model_TournamentLocation', $id));
        }

        $bracket->getTournamentLocations()->setDirty(true);{code}
        Benjamin Eberlei made changes -
        Issue Type Bug [ 1 ] Improvement [ 4 ]
        Fix Version/s 2.2-DEV [ 10157 ]
        Guilherme Blanco made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Benjamin Eberlei [ beberlei ] Guilherme Blanco [ guilhermeblanco ]
        Resolution Fixed [ 1 ]
        Glen Ainscow made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Benjamin Eberlei made changes -
        Fix Version/s 2.3 [ 10185 ]
        Fix Version/s 2.2 [ 10157 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 12840 ] jira-feedback [ 14103 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 14103 ] jira-feedback2 [ 15967 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 15967 ] jira-feedback3 [ 18221 ]
        Benjamin Eberlei made changes -
        Fix Version/s 2.4 [ 10321 ]
        Fix Version/s 2.3 [ 10185 ]
        Benjamin Eberlei made changes -
        Fix Version/s 2.5 [ 10522 ]
        Fix Version/s 2.4 [ 10321 ]

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Glen Ainscow
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: