src/Sulu/Bundle/SecurityBundle/Controller/GroupController.php
public function putAction(Request $request, $id)
    {
        /** @var Group $group */
        $group = $this->getDoctrine()
            ->getRepository(static::$entityName)
            ->findGroupById($id);

        try {
            if (!$group) {
                throw new EntityNotFoundException(static::$entityName, $id);
            } else {
                $em = $this->getDoctrine()->getManager();

                $name = $request->get('name');

                $group->setName($name);

                $this->setParent($group, $request);

                if (!$this->processRoles($group, $request->get('roles', []))) {
                    throw new RestException('Could not update dependencies!');
                }

                $em->flush();
                $view = $this->view($group, 200);
            }
        } catch (EntityNotFoundException $enfe) {
            $view = $this->view($enfe->toArray(), 404);
        } catch (RestException $re) {
            $view = $this->view($re->toArray(), 400);
        }

        return $this->handleView($view);
    }
public function putAction(Request $request, $id)
    {
        /** @var Group $group */
        $group = $this->getDoctrine()
            ->getRepository(static::$entityName)
            ->findGroupById($id);

        try {
            if (!$group) {
                throw new EntityNotFoundException(static::$entityName, $id);
            } else {
                $em = $this->getDoctrine()->getManager();

                $name = $request->get('name');

                $group->setName($name);

                $this->setParent($group, $request);

                if (!$this->processRoles($group, $request->get('roles', []))) {
                    throw new RestException('Could not update dependencies!');
                }

                $em->flush();
                $view = $this->view($group, 200);
            }
        } catch (EntityNotFoundException $enfe) {
            $view = $this->view($enfe->toArray(), 404);
        } catch (RestException $re) {
            $view = $this->view($re->toArray(), 400);
        }

        return $this->handleView($view);
    }
public function putAction ( Request $ request , $ id ) { /** @var Group $group */ $ group = $ this -> getDoctrine ( ) -> getRepository ( static :: $ entityName ) -> findGroupById ( $ id ) ; try { if ( ! $ group ) { throw new EntityNotFoundException ( static :: $ entityName , $ id ) ; } else { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ name = $ request -> get ( 'name' ) ; $ group -> setName ( $ name ) ; $ this -> setParent ( $ group , $ request ) ; if ( ! $ this -> processRoles ( $ group , $ request -> get ( 'roles' , [ ] ) ) ) { throw new RestException ( 'Could not update dependencies!' ) ; } $ em -> flush ( ) ; $ view = $ this -> view ( $ group , 200 ) ; } } catch ( EntityNotFoundException $ enfe ) { $ view = $ this -> view ( $ enfe -> toArray ( ) , 404 ) ; } catch ( RestException $ re ) { $ view = $ this -> view ( $ re -> toArray ( ) , 400 ) ; } return $ this -> handleView ( $ view ) ; }
Updates the group with the given id and the data given by the request.

@param \Symfony\Component\HttpFoundation\Request $request
@param $id

@return \Symfony\Component\HttpFoundation\Response
Updates the group with the given id and the data given by the request .