Exemplo n.º 1
0
 public function __invoke(ServerRequestInterface $request, ResponseInterface $response)
 {
     $id = $request->getAttribute('id');
     if (!($comment = $this->repository->find($id))) {
         return $response->withStatus(404, 'post not found');
     }
     $this->view->render($response, 'post.phtml', ['comment' => new CommentViewModel($comment)]);
     return $response;
 }