我希望能够检索一个实体的现有版本,以便我能够将其与最新版本进行比较。 E.g. 编辑文件,我想知道,自在非行,价值是否发生了变化。
$entityManager = $this->get( doctrine )->getEntityManager();
$postManager = $this->get( synth_knowledge_share.manager );
$repository = $entityManager->getRepository( KnowledgeShareBundle:Post );
$post = $repository->findOneById(1);
var_dump($post->getTitle()); // This would output "My Title"
$post->setTitle("Unpersisted new title");
$existingPost = $repository->findOneById(1); // Retrieve the old entity
var_dump($existingPost->getTitle()); // This would output "Unpersisted new title" instead of the expected "My Title"
是否有任何人知道我如何能够绕过这一ach子?