eZ\Publish\Core\Limitation\OwnerLimitationType::getCriterion PHP Method

getCriterion() public method

Returns Criterion for use in find() query.
public getCriterion ( eZ\Publish\API\Repository\Values\User\Limitation $value, eZ\Publish\API\Repository\Values\User\UserReference $currentUser ) : eZ\Publish\API\Repository\Values\Content\Query\CriterionInterface
$value eZ\Publish\API\Repository\Values\User\Limitation
$currentUser eZ\Publish\API\Repository\Values\User\UserReference
return eZ\Publish\API\Repository\Values\Content\Query\CriterionInterface
    public function getCriterion(APILimitationValue $value, APIUserReference $currentUser)
    {
        if (empty($value->limitationValues)) {
            // no limitation values
            throw new \RuntimeException('$value->limitationValues is empty, it should not have been stored in the first place');
        }
        if ($value->limitationValues[0] != 1 && $value->limitationValues[0] != 2) {
            throw new BadStateException('Parent User Group limitation', 'expected limitation value to be 1 but got:' . $value->limitationValues[0]);
        }
        return new Criterion\UserMetadata(Criterion\UserMetadata::OWNER, Criterion\Operator::EQ, $currentUser->getUserId());
    }