public function removePolicyByRoleDraft($roleId, $policyId, Request $request)
    {
        $roleDraft = $this->roleService->loadRoleDraft($roleId);

        $policy = null;
        foreach ($roleDraft->getPolicies() as $rolePolicy) {
            if ($rolePolicy->id == $policyId) {
                $policy = $rolePolicy;
                break;
            }
        }

        if ($policy !== null) {
            $this->roleService->removePolicyByRoleDraft($roleDraft, $policy);

            return new Values\NoContent();
        }

        throw new Exceptions\NotFoundException("Policy not found: '{$request->getPathInfo()}'.");
    }
public function removePolicyByRoleDraft($roleId, $policyId, Request $request)
    {
        $roleDraft = $this->roleService->loadRoleDraft($roleId);

        $policy = null;
        foreach ($roleDraft->getPolicies() as $rolePolicy) {
            if ($rolePolicy->id == $policyId) {
                $policy = $rolePolicy;
                break;
            }
        }

        if ($policy !== null) {
            $this->roleService->removePolicyByRoleDraft($roleDraft, $policy);

            return new Values\NoContent();
        }

        throw new Exceptions\NotFoundException("Policy not found: '{$request->getPathInfo()}'.");
    }
public function removePolicyByRoleDraft ( $ roleId , $ policyId , Request $ request ) { $ roleDraft = $ this -> roleService -> loadRoleDraft ( $ roleId ) ; $ policy = null ; foreach ( $ roleDraft -> getPolicies ( ) as $ rolePolicy ) { if ( $ rolePolicy -> id == $ policyId ) { $ policy = $ rolePolicy ; break ; } } if ( $ policy !== null ) { $ this -> roleService -> removePolicyByRoleDraft ( $ roleDraft , $ policy ) ; return new Values \ NoContent ( ) ; } throw new Exceptions \ NotFoundException ( "Policy not found: '{$request->getPathInfo()}'." ) ; }
Remove a policy from a role draft.

@since 6.2
@deprecated since 6.3, use {@see deletePolicy}

@param $roleId
@param $policyId

@throws \eZ\Publish\Core\REST\Common\Exceptions\NotFoundException

@return \eZ\Publish\Core\REST\Server\Values\NoContent
Remove a policy from a role draft .