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

          People

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

            Dates

            • Created:
              Updated: