I want to be able to retrieve the existing version of an entity so I can compare it with the latest version. E.g. Editing a file, I want to know if the value has changed sin
You can also use the refresh method, which refreshes the persistent state of an entity from the database, overriding any local changes that have not yet been persisted.
Something like:
$entityManager = $this->get('doctrine')->getEntityManager();
$repository = $entityManager->getRepository('KnowledgeShareBundle:Post');
$post = $repository->find(1);
$entityManager->refresh($post);
now $post contains the last version from database.