public function discardBlockAction(Request $request)
    {
        $this->getDoctrine()->getManager()->getFilters()->disable('draft');

        /** @var BlockManager $manager */
        $manager = $this->get('opifer.content.block_manager');

        $response = new JsonResponse;
        $id = (int) $request->request->get('id');

        try {
            $manager->discardAll($id);

            $response->setStatusCode(200);
            $response->setData(['state' => 'discarded']);
        } catch (\Exception $e) {
            $response->setStatusCode(500);
            $response->setData(['error' => $e->getMessage()]);
        }

        return $response;
    }
public function discardBlockAction(Request $request)
    {
        $this->getDoctrine()->getManager()->getFilters()->disable('draft');

        /** @var BlockManager $manager */
        $manager = $this->get('opifer.content.block_manager');

        $response = new JsonResponse;
        $id = (int) $request->request->get('id');

        try {
            $manager->discardAll($id);

            $response->setStatusCode(200);
            $response->setData(['state' => 'discarded']);
        } catch (\Exception $e) {
            $response->setStatusCode(500);
            $response->setData(['error' => $e->getMessage()]);
        }

        return $response;
    }
public function discardBlockAction ( Request $ request ) { $ this -> getDoctrine ( ) -> getManager ( ) -> getFilters ( ) -> disable ( 'draft' ) ; /** @var BlockManager $manager */ $ manager = $ this -> get ( 'opifer.content.block_manager' ) ; $ response = new JsonResponse ; $ id = ( int ) $ request -> request -> get ( 'id' ) ; try { $ manager -> discardAll ( $ id ) ; $ response -> setStatusCode ( 200 ) ; $ response -> setData ( [ 'state' => 'discarded' ] ) ; } catch ( \ Exception $ e ) { $ response -> setStatusCode ( 500 ) ; $ response -> setData ( [ 'error' => $ e -> getMessage ( ) ] ) ; } return $ response ; }
Discards all changes to block and it's members

@param Request $request

@return JsonResponse
Discards all changes to block and it s members