Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-1283

Possible issue with PersistentCollection#getDelete/InsertDiff()

    Details

    • Type: Improvement
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • 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

        darkangel Glen Ainscow created issue -
        darkangel 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}
        beberlei Benjamin Eberlei made changes -
        Issue Type Bug [ 1 ] Improvement [ 4 ]
        Fix Version/s 2.2-DEV [ 10157 ]
        guilhermeblanco Guilherme Blanco made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Benjamin Eberlei [ beberlei ] Guilherme Blanco [ guilhermeblanco ]
        Resolution Fixed [ 1 ]
        darkangel Glen Ainscow made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        beberlei Benjamin Eberlei made changes -
        Fix Version/s 2.3 [ 10185 ]
        Fix Version/s 2.2 [ 10157 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira [ 12840 ] jira-feedback [ 14103 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira-feedback [ 14103 ] jira-feedback2 [ 15967 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 15967 ] jira-feedback3 [ 18221 ]
        beberlei Benjamin Eberlei made changes -
        Fix Version/s 2.4 [ 10321 ]
        Fix Version/s 2.3 [ 10185 ]
        beberlei Benjamin Eberlei made changes -
        Fix Version/s 2.5 [ 10522 ]
        Fix Version/s 2.4 [ 10321 ]
        ocramius Marco Pivetta made changes -
        Fix Version/s 2.5 [ 10522 ]

          People

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

            Dates

            • Created:
              Updated: