Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-74

Updates get lost when Lifecycle Events (@PreUpdate) are invoked

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0-ALPHA4
    • Component/s: Mapping Drivers
    • Security Level: All
    • Labels:
      None

      Description

      When Lifecycle Events are invoked on entity update (@PreUpdate), the entity is not updated properly in the database.

      This code creates a User object, sets its name to "Bob" and its value to empty, then updates the object and updates the name to "Alice".

      $user = new User;
      $user->setName('Bob');
      $user->setValue('');
      $em->persist($user);
      $em->flush();
      $user->setName('Alice');
      $em->flush();

      However, when the User class has a @PreUpdate event that e.g. sets the value to "Hello World", the name change gets lost and only the value is updated by the second flush() call.

      This is a critical bug which prevents creation of entities that simulate the "Timestampable" behaviour of Doctrine 1.x...

        Activity

          People

          • Assignee:
            Roman S. Borschel
            Reporter:
            Nico Kaiser
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: