Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2839

[GH-869] Detach objects in original object data


    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:


      This issue is created automatically through a Github pull request on behalf of tomphp:



      The PR makes Doctrine ORM update the database when you execute something like this:

      // MyEntity.php


      • @Entity
        class MyEntity
        // ...


      • @Column(type="datetime")
        private $created;

      // ...

      public function setCreated(\DateTime $created)

      { $this->created = $created; }

      public function getCreated()

      { return $this->created; }

      // ...

      // Current problem

      $entity = $entityManager->find('MyEntity', 1);




      // At this point no changes have been made to the database!

      The reason this doesn't work currently is because the array of original data stored in the UnitOfWork contains the actual DateTime object which is in the entity. When you update the object in the entity the original data is updated also so the entity are the original value are still equal and therefore the object is not seen as changed.

      I have chosen to clone all objects rather than just DateTime object include more types are included in the future.

        Issue Links


          Doctrine Bot created issue -
          Doctrine Bot added a comment -

          A related Github Pull-Request [GH-869] was closed:

          Doctrine Bot added a comment - A related Github Pull-Request [GH-869] was closed:
          Marco Pivetta made changes -
          Field Original Value New Value
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Benjamin Eberlei [ beberlei ] Marco Pivetta [ ocramius ]
          Resolution Invalid [ 6 ]
          Marco Pivetta made changes -
          Remote Link This issue links to "Working with DateTime and Doctrine ORM (Web Link)" [ 10032 ]

          This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

          • Request to failed: Error in remote call to 'FishEye 0 (' ( [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-2839, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)


            • Assignee:
              Marco Pivetta
              Doctrine Bot
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: