Doctrine merge: DateTime field always updated
问题 I create a new Entity with an existing Id , and I want to update the related database record. Doctrine merge has been my best friend: recognizes if there are changes and generates the correct update query. $entity = new Entity(); $entity->setId(1); $entity->setName('test'); $EntityManager->merge($entity); $EntityManager->flush(); Suppose that the element with the id=1 already exists in the db: if the name is different from 'test', Doctrine generates this query: UPDATE table SET name = ? WHERE