RestBundle\Controller\RestController::getCommentAction PHP Method

getCommentAction() public method

Get a specific comment.
public getCommentAction ( integer $id ) : FOS\RestBundle\View\View
$id integer
return FOS\RestBundle\View\View
    public function getCommentAction($id)
    {
        $em = $this->getDoctrine()->getManager();
        $comment = $em->getRepository('AppBundle:Comment')->find($id);
        if (null === $comment) {
            throw $this->createNotFoundException("Comment does not exist.");
        }
        $view = $this->view($comment)->setTemplate('RestBundle:Comment:getComment.html.twig')->setTemplateVar('comment');
        return $this->handleView($view);
    }