/** * Deletes a comment * * @ApiDoc( * requirements={ * {"name"="id", "dataType"="integer", "requirement"="\d+", "description"="comment identifier"} * }, * statusCodes={ * 200="Returned when comment is successfully deleted", * 400="Returned when an error has occurred while comment deletion", * 404="Returned when unable to find comment" * } * ) * * @Route(requirements={"_format"="json|xml"}) * * @param integer $id A comment identifier * * @return \FOS\RestBundle\View\View * * @throws NotFoundHttpException */ public function deleteCommentAction($id) { $comment = $this->getComment($id); try { $this->commentManager->delete($comment); } catch (\Exception $e) { return \FOS\RestBundle\View\View::create(array('error' => $e->getMessage()), 400); } return array('deleted' => true); }