RestBundle\Controller\RestController::editCommentAction PHP Метод

editCommentAction() публичный Метод

Partial update of an existing Comment.
public editCommentAction ( Request $request, Request $id ) : FOS\RestBundle\View\View | Response
$request Symfony\Component\HttpFoundation\Request
$id Symfony\Component\HttpFoundation\Request
Результат FOS\RestBundle\View\View | Symfony\Component\HttpFoundation\Response
    public function editCommentAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();
        $comment = $em->getRepository('AppBundle:Comment')->find($id);
        $form = $this->createForm(new CommentRestType(), $comment);
        $form->submit($request, false);
        if ($form->isValid()) {
            $em->flush();
            return $this->routeRedirectView('api_v1_get_comment', array('id' => $comment->getId()), Response::HTTP_NO_CONTENT);
        }
        $view = $this->view($form)->setTemplate('RestBundle:Comment:editComment.html.twig')->setStatusCode(Response::HTTP_NO_CONTENT);
        return $this->handleView($view);
    }