我希望能够检索实体的现有版本,以便将其与最新版本进行比较.例如,编辑文件,我想知道自从进入数据库以来该值是否已更改.
$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"
Run Code Online (Sandbox Code Playgroud)
有谁知道如何绕过这个缓存?
我在控制器中,我想重定向回URL,比如/ home/news/example#comment1423
如何将哈希值添加到返回参数中?
return $this->redirect(
$this->generateUrl("news_view", array("permalink" => "example"))
);
Run Code Online (Sandbox Code Playgroud)