public function showAction(Post $post)
{
// This security check can also be performed:
// 1. Using an annotation: @Security("post.isAuthor(user)")
// 2. Using a "voter" (see http://symfony.com/doc/current/cookbook/security/voters_data_permission.html)
if (null === $this->getUser() || !$post->isAuthor($this->getUser())) {
throw $this->createAccessDeniedException('Posts can only be shown to their authors.');
}
$deleteForm = $this->createDeleteForm($post);
return $this->render('admin/blog/show.html.twig', array('post' => $post, 'delete_form' => $deleteForm->createView()));
}