public function editAction(Request $request, $name, $id, $data, $value) {

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

        $dtEditor = $this->getDataTablesEditor($dtProvider);

        $dtColumn = $this->getDataTablesColumn($dtProvider, $data);

        try {

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

            if (true === $request->isMethod(HTTPInterface::HTTP_METHOD_POST)) {
                $value = $request->request->get("value");
            }

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

            $dtEditor->editColumn($dtColumn, $entity, $value);

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

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

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

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

        return new JsonResponse($output);
    }
public function editAction(Request $request, $name, $id, $data, $value) {

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

        $dtEditor = $this->getDataTablesEditor($dtProvider);

        $dtColumn = $this->getDataTablesColumn($dtProvider, $data);

        try {

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

            if (true === $request->isMethod(HTTPInterface::HTTP_METHOD_POST)) {
                $value = $request->request->get("value");
            }

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

            $dtEditor->editColumn($dtColumn, $entity, $value);

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

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

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

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

        return new JsonResponse($output);
    }
public function editAction ( Request $ request , $ name , $ id , $ data , $ value ) { $ dtProvider = $ this -> getDataTablesProvider ( $ name ) ; $ dtEditor = $ this -> getDataTablesEditor ( $ dtProvider ) ; $ dtColumn = $ this -> getDataTablesColumn ( $ dtProvider , $ data ) ; try { $ entity = $ this -> getDataTablesEntityById ( $ dtProvider , $ id ) ; if ( true === $ request -> isMethod ( HTTPInterface :: HTTP_METHOD_POST ) ) { $ value = $ request -> request -> get ( "value" ) ; } $ this -> dispatchDataTablesEvent ( DataTablesEvents :: DATATABLES_PRE_EDIT , [ $ entity ] ) ; $ dtEditor -> editColumn ( $ dtColumn , $ entity , $ value ) ; $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ entity ) ; $ em -> flush ( ) ; $ this -> dispatchDataTablesEvent ( DataTablesEvents :: DATATABLES_POST_EDIT , [ $ entity ] ) ; $ output = $ this -> prepareActionResponse ( 200 , "DataTablesController.editAction.success" ) ; } catch ( Exception $ ex ) { $ output = $ this -> handleDataTablesException ( $ ex , "DataTablesController.editAction" ) ; } return new JsonResponse ( $ output ) ; }
Edit an existing entity.

@param Request $request The request.
@param string $name The provider name
@param string $id The entity id.
@param string $data The data.
@param mixed $value The value
@return Response Returns the response.
@throws UnregisteredDataTablesProviderException Throws an unregistered provider exception.
@throws BadDataTablesEditorException Throws a bad editor exception.
@throws BadDataTablesColumnException Throws a bad column exception.
Edit an existing entity .