public function deleteAction(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            throw new NotFoundHttpException();
        }

        $folder = $this->findFolderById($request->attributes->get('id'));

        $result = array();
        try {
            $this->removeFolder($folder);
        } catch (DBALException $e) {
            $result = array(
                'error'   => true,
                'message' => 'Ce dossier n\'est pas vide.',
            );
        }

        $response = new Response(json_encode($result, JSON_FORCE_OBJECT));
        $response->headers->add(array('Content-Type' => 'application/json'));
        return $response;
    }
public function deleteAction(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            throw new NotFoundHttpException();
        }

        $folder = $this->findFolderById($request->attributes->get('id'));

        $result = array();
        try {
            $this->removeFolder($folder);
        } catch (DBALException $e) {
            $result = array(
                'error'   => true,
                'message' => 'Ce dossier n\'est pas vide.',
            );
        }

        $response = new Response(json_encode($result, JSON_FORCE_OBJECT));
        $response->headers->add(array('Content-Type' => 'application/json'));
        return $response;
    }
public function deleteAction ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { throw new NotFoundHttpException ( ) ; } $ folder = $ this -> findFolderById ( $ request -> attributes -> get ( 'id' ) ) ; $ result = array ( ) ; try { $ this -> removeFolder ( $ folder ) ; } catch ( DBALException $ e ) { $ result = array ( 'error' => true , 'message' => 'Ce dossier n\'est pas vide.' , ) ; } $ response = new Response ( json_encode ( $ result , JSON_FORCE_OBJECT ) ) ; $ response -> headers -> add ( array ( 'Content-Type' => 'application/json' ) ) ; return $ response ; }
Deletes the folder.

@param Request $request

@return Response
Deletes the folder .