public function deleteAction(Request $request, $name, $id) {

        $dtProvider = $this->getDataTablesProvider($name);

        try {

            $entity = $this->getDataTablesEntityById($dtProvider, $id);

            $this->dispatchDataTablesEvent(DataTablesEvents::DATATABLES_PRE_DELETE, [$entity]);

            $em = $this->getDoctrine()->getManager();
            $em->remove($entity);
            $em->flush();

            $this->dispatchDataTablesEvent(DataTablesEvents::DATATABLES_POST_DELETE, [$entity]);

            $output = $this->prepareActionResponse(200, "DataTablesController.deleteAction.success");
        } catch (Exception $ex) {

            $output = $this->handleDataTablesException($ex, "DataTablesController.deleteAction");
        }

        return $this->buildDataTablesResponse($request, $name, $output);
    }
public function deleteAction(Request $request, $name, $id) {

        $dtProvider = $this->getDataTablesProvider($name);

        try {

            $entity = $this->getDataTablesEntityById($dtProvider, $id);

            $this->dispatchDataTablesEvent(DataTablesEvents::DATATABLES_PRE_DELETE, [$entity]);

            $em = $this->getDoctrine()->getManager();
            $em->remove($entity);
            $em->flush();

            $this->dispatchDataTablesEvent(DataTablesEvents::DATATABLES_POST_DELETE, [$entity]);

            $output = $this->prepareActionResponse(200, "DataTablesController.deleteAction.success");
        } catch (Exception $ex) {

            $output = $this->handleDataTablesException($ex, "DataTablesController.deleteAction");
        }

        return $this->buildDataTablesResponse($request, $name, $output);
    }
public function deleteAction ( Request $ request , $ name , $ id ) { $ dtProvider = $ this -> getDataTablesProvider ( $ name ) ; try { $ entity = $ this -> getDataTablesEntityById ( $ dtProvider , $ id ) ; $ this -> dispatchDataTablesEvent ( DataTablesEvents :: DATATABLES_PRE_DELETE , [ $ entity ] ) ; $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> remove ( $ entity ) ; $ em -> flush ( ) ; $ this -> dispatchDataTablesEvent ( DataTablesEvents :: DATATABLES_POST_DELETE , [ $ entity ] ) ; $ output = $ this -> prepareActionResponse ( 200 , "DataTablesController.deleteAction.success" ) ; } catch ( Exception $ ex ) { $ output = $ this -> handleDataTablesException ( $ ex , "DataTablesController.deleteAction" ) ; } return $ this -> buildDataTablesResponse ( $ request , $ name , $ output ) ; }
Delete an existing entity.

@param Request $request The request.
@param string $name The provider name.
@param string $id The entity id.
@return Response Returns the response.
@throws UnregisteredDataTablesProviderException Throws an unregistered provider exception.
Delete an existing entity .