src/Sulu/Bundle/SecurityBundle/Controller/RoleController.php
protected function processPermissions(RoleInterface $role, $permissions)
    {
        /** @var RestHelperInterface $restHelper */
        $restHelper = $this->get('sulu_core.doctrine_rest_helper');

        $get = function($entity) {
            /* @var Permission $entity */

            return $entity->getId();
        };

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

        $update = function($permission, $permissionData) {
            return $this->updatePermission($permission, $permissionData);
        };

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

        return $restHelper->processSubEntities($role->getPermissions(), $permissions, $get, $add, $update, $delete);
    }
protected function processPermissions(RoleInterface $role, $permissions)
    {
        /** @var RestHelperInterface $restHelper */
        $restHelper = $this->get('sulu_core.doctrine_rest_helper');

        $get = function($entity) {
            /* @var Permission $entity */

            return $entity->getId();
        };

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

        $update = function($permission, $permissionData) {
            return $this->updatePermission($permission, $permissionData);
        };

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

        return $restHelper->processSubEntities($role->getPermissions(), $permissions, $get, $add, $update, $delete);
    }
protected function processPermissions ( RoleInterface $ role , $ permissions ) { /** @var RestHelperInterface $restHelper */ $ restHelper = $ this -> get ( 'sulu_core.doctrine_rest_helper' ) ; $ get = function ( $ entity ) { /* @var Permission $entity */ return $ entity -> getId ( ) ; } ; $ delete = function ( $ permission ) { $ this -> getDoctrine ( ) -> getManager ( ) -> remove ( $ permission ) ; } ; $ update = function ( $ permission , $ permissionData ) { return $ this -> updatePermission ( $ permission , $ permissionData ) ; } ; $ add = function ( $ permission ) use ( $ role ) { return $ this -> addPermission ( $ role , $ permission ) ; } ; return $ restHelper -> processSubEntities ( $ role -> getPermissions ( ) , $ permissions , $ get , $ add , $ update , $ delete ) ; }
Process all permissions from request.

@param RoleInterface $role The contact on which is worked
@param $permissions

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