eZ\Publish\Core\REST\Server\Input\Parser\Criterion\ParentLocationRemoteId::parse PHP Method

parse() public method

Parses input structure to a Criterion object.
public parse ( array $data, ParsingDispatcher $parsingDispatcher ) : eZ\Publish\API\Repository\Values\Content\Query\Criterion\ParentLocationId
$data array
$parsingDispatcher eZ\Publish\Core\REST\Common\Input\ParsingDispatcher
return eZ\Publish\API\Repository\Values\Content\Query\Criterion\ParentLocationId
    public function parse(array $data, ParsingDispatcher $parsingDispatcher)
    {
        if (!array_key_exists('ParentLocationRemoteIdCriterion', $data)) {
            throw new Exceptions\Parser('Invalid <ParentLocationRemoteIdCriterion> format');
        }
        $contentIdArray = array();
        foreach (explode(',', $data['ParentLocationRemoteIdCriterion']) as $parentRemoteId) {
            $location = $this->locationService->loadLocationByRemoteId($parentRemoteId);
            $contentIdArray[] = $location->id;
        }
        return new ParentLocationIdCriterion($contentIdArray);
    }
ParentLocationRemoteId