src/Sulu/Bundle/SecurityBundle/Controller/GroupController.php
protected function processRoles(Group $group, $roles)
    {
        /** @var RestHelperInterface $restHelper */
        $restHelper = $this->get('sulu_core.doctrine_rest_helper');

        $get = function($entity) {
            /* @var RoleInterface $entity */
            return $entity->getId();
        };

        $delete = function($role) {
            $this->getDoctrine()->getManager()->remove($role);
        };

        $update = function($role, $roleData) {
            return $this->updateRole($role, $roleData);
        };

        $add = function($role) use ($group) {
            return $this->addRole($group, $role);
        };

        return $restHelper->processSubEntities($group->getRoles(), $roles, $get, $add, $update, $delete);
    }
protected function processRoles(Group $group, $roles)
    {
        /** @var RestHelperInterface $restHelper */
        $restHelper = $this->get('sulu_core.doctrine_rest_helper');

        $get = function($entity) {
            /* @var RoleInterface $entity */
            return $entity->getId();
        };

        $delete = function($role) {
            $this->getDoctrine()->getManager()->remove($role);
        };

        $update = function($role, $roleData) {
            return $this->updateRole($role, $roleData);
        };

        $add = function($role) use ($group) {
            return $this->addRole($group, $role);
        };

        return $restHelper->processSubEntities($group->getRoles(), $roles, $get, $add, $update, $delete);
    }
protected function processRoles ( Group $ group , $ roles ) { /** @var RestHelperInterface $restHelper */ $ restHelper = $ this -> get ( 'sulu_core.doctrine_rest_helper' ) ; $ get = function ( $ entity ) { /* @var RoleInterface $entity */ return $ entity -> getId ( ) ; } ; $ delete = function ( $ role ) { $ this -> getDoctrine ( ) -> getManager ( ) -> remove ( $ role ) ; } ; $ update = function ( $ role , $ roleData ) { return $ this -> updateRole ( $ role , $ roleData ) ; } ; $ add = function ( $ role ) use ( $ group ) { return $ this -> addRole ( $ group , $ role ) ; } ; return $ restHelper -> processSubEntities ( $ group -> getRoles ( ) , $ roles , $ get , $ add , $ update , $ delete ) ; }
Process all roles from request.

@param Group $group The contact on which is worked
@param array $roles The roles to process

@return bool True if the processing was successful, otherwise false
Process all roles from request .