protected function internalCreateRole(RoleCreateStruct $createStruct, $roleId = null)
    {
        $createStruct = clone $createStruct;
        $role = $this->mapper->createRoleFromCreateStruct(
            $createStruct
        );
        $role->id = $roleId;
        $role->status = Role::STATUS_DRAFT;

        $this->roleGateway->createRole($role);

        foreach ($role->policies as $policy) {
            $this->addPolicyByRoleDraft($role->id, $policy);
        }

        return $role;
    }
protected function internalCreateRole(RoleCreateStruct $createStruct, $roleId = null)
    {
        $createStruct = clone $createStruct;
        $role = $this->mapper->createRoleFromCreateStruct(
            $createStruct
        );
        $role->id = $roleId;
        $role->status = Role::STATUS_DRAFT;

        $this->roleGateway->createRole($role);

        foreach ($role->policies as $policy) {
            $this->addPolicyByRoleDraft($role->id, $policy);
        }

        return $role;
    }
protected function internalCreateRole ( RoleCreateStruct $ createStruct , $ roleId = null ) { $ createStruct = clone $ createStruct ; $ role = $ this -> mapper -> createRoleFromCreateStruct ( $ createStruct ) ; $ role -> id = $ roleId ; $ role -> status = Role :: STATUS_DRAFT ; $ this -> roleGateway -> createRole ( $ role ) ; foreach ( $ role -> policies as $ policy ) { $ this -> addPolicyByRoleDraft ( $ role -> id , $ policy ) ; } return $ role ; }
Internal method for creating Role.

Used by self::createRole() and self::createRoleDraft()

@param \eZ\Publish\SPI\Persistence\User\RoleCreateStruct $createStruct
@param mixed|null $roleId Used by self::createRoleDraft() to retain Role id in the draft

@return \eZ\Publish\SPI\Persistence\User\Role
Internal method for creating Role .