public function buildDomainPolicyObject(SPIPolicy $spiPolicy)
    {
        $policyLimitations = array();
        if ($spiPolicy->module !== '*' && $spiPolicy->function !== '*' && $spiPolicy->limitations !== '*') {
            foreach ($spiPolicy->limitations as $identifier => $values) {
                $policyLimitations[] = $this->limitationService->getLimitationType($identifier)->buildValue($values);
            }
        }

        $policy = new Policy(
            array(
                'id' => $spiPolicy->id,
                'roleId' => $spiPolicy->roleId,
                'module' => $spiPolicy->module,
                'function' => $spiPolicy->function,
                'limitations' => $policyLimitations,
            )
        );

        // Original ID is set on SPI policy, which means that it's a draft.
        if ($spiPolicy->originalId) {
            $policy = new PolicyDraft(['innerPolicy' => $policy, 'originalId' => $spiPolicy->originalId]);
        }

        return $policy;
    }
public function buildDomainPolicyObject(SPIPolicy $spiPolicy)
    {
        $policyLimitations = array();
        if ($spiPolicy->module !== '*' && $spiPolicy->function !== '*' && $spiPolicy->limitations !== '*') {
            foreach ($spiPolicy->limitations as $identifier => $values) {
                $policyLimitations[] = $this->limitationService->getLimitationType($identifier)->buildValue($values);
            }
        }

        $policy = new Policy(
            array(
                'id' => $spiPolicy->id,
                'roleId' => $spiPolicy->roleId,
                'module' => $spiPolicy->module,
                'function' => $spiPolicy->function,
                'limitations' => $policyLimitations,
            )
        );

        // Original ID is set on SPI policy, which means that it's a draft.
        if ($spiPolicy->originalId) {
            $policy = new PolicyDraft(['innerPolicy' => $policy, 'originalId' => $spiPolicy->originalId]);
        }

        return $policy;
    }
public function buildDomainPolicyObject ( SPIPolicy $ spiPolicy ) { $ policyLimitations = array ( ) ; if ( $ spiPolicy -> module !== '*' && $ spiPolicy -> function !== '*' && $ spiPolicy -> limitations !== '*' ) { foreach ( $ spiPolicy -> limitations as $ identifier => $ values ) { $ policyLimitations [ ] = $ this -> limitationService -> getLimitationType ( $ identifier ) -> buildValue ( $ values ) ; } } $ policy = new Policy ( array ( 'id' => $ spiPolicy -> id , 'roleId' => $ spiPolicy -> roleId , 'module' => $ spiPolicy -> module , 'function' => $ spiPolicy -> function , 'limitations' => $ policyLimitations , ) ) ; // Original ID is set on SPI policy, which means that it's a draft. if ( $ spiPolicy -> originalId ) { $ policy = new PolicyDraft ( [ 'innerPolicy' => $ policy , 'originalId' => $ spiPolicy -> originalId ] ) ; } return $ policy ; }
Maps provided SPI Policy value object to API Policy value object.

@param \eZ\Publish\SPI\Persistence\User\Policy $spiPolicy

@return \eZ\Publish\API\Repository\Values\User\Policy|\eZ\Publish\API\Repository\Values\User\PolicyDraft
Maps provided SPI Policy value object to API Policy value object .