public function deleteAction(Request $request, $access, Message $message)
    {
        $this->denyAccessUnlessGranted('edit', $message);
        $form = $this->createDeleteForm($message);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrineManager();
            $em->remove($message);
            $em->flush($message);
        }
        if ($this->isRest($access))
            return new JsonResponse(array("status" => "DELETED"),
                Response::HTTP_OK);
        else
            return $this->redirect($request->headers->get('referer'));
    }
public function deleteAction(Request $request, $access, Message $message)
    {
        $this->denyAccessUnlessGranted('edit', $message);
        $form = $this->createDeleteForm($message);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrineManager();
            $em->remove($message);
            $em->flush($message);
        }
        if ($this->isRest($access))
            return new JsonResponse(array("status" => "DELETED"),
                Response::HTTP_OK);
        else
            return $this->redirect($request->headers->get('referer'));
    }
public function deleteAction ( Request $ request , $ access , Message $ message ) { $ this -> denyAccessUnlessGranted ( 'edit' , $ message ) ; $ form = $ this -> createDeleteForm ( $ message ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -> getDoctrineManager ( ) ; $ em -> remove ( $ message ) ; $ em -> flush ( $ message ) ; } if ( $ this -> isRest ( $ access ) ) return new JsonResponse ( array ( "status" => "DELETED" ) , Response :: HTTP_OK ) ; else return $ this -> redirect ( $ request -> headers -> get ( 'referer' ) ) ; }
Deletes a message entity.

@Route("/{id}", name="message_delete", methods={"DELETE"})
Deletes a message entity .