Example #1
0
 public function __invoke(Request $request)
 {
     $repository = $this->getService('repository.blog_post');
     $id = $request->getAttribute('id');
     if (!($post = $repository->find($id))) {
         throw new HttpNotFoundException(sprintf('No blog post found for id #%u.', $id));
     }
     return $this->render('blog/show.twig', ['post' => $post]);
 }