Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

ParentLocationRemoteId.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Server\Input\Parser\Criterion;
8
9 use eZ\Publish\Core\REST\Common\Input\BaseParser;
10 use eZ\Publish\Core\REST\Common\Input\ParsingDispatcher;
11 use eZ\Publish\Core\REST\Common\Exceptions;
12 use eZ\Publish\API\Repository\LocationService;
13 use eZ\Publish\API\Repository\Values\Content\Query\Criterion\ParentLocationId as ParentLocationIdCriterion;
14
18 class ParentLocationRemoteId extends BaseParser
19 {
25 protected $locationService;
26
27 public function __construct(LocationService $locationService)
28 {
29 $this->locationService = $locationService;
30 }
31
42 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
43 {
44 if (!array_key_exists('ParentLocationRemoteIdCriterion', $data)) {
45 throw new Exceptions\Parser('Invalid <ParentLocationRemoteIdCriterion> format');
46 }
47 $contentIdArray = [];
48 foreach (explode(',', $data['ParentLocationRemoteIdCriterion']) as $parentRemoteId) {
49 $location = $this->locationService->loadLocationByRemoteId($parentRemoteId);
50 $contentIdArray[] = $location->id;
51 }
52
53 return new ParentLocationIdCriterion($contentIdArray);
54 }
55 }
eZ\Publish\API\Repository\Values\Content\Query\Criterion\ParentLocationId
A criterion that matches content based on its parent location id.
Definition: API/Repository/Values/Content/Query/Criterion/ParentLocationId.php:22
eZ\Publish\Core\REST\Common\Input\BaseParser
Definition: BaseParser.php:12
eZ\Publish\Core\REST\Common\Input\ParsingDispatcher
Parsing dispatcher.
Definition: ParsingDispatcher.php:15
eZ\Publish\Core\REST\Server\Input\Parser\Criterion\ParentLocationRemoteId
Parser for ParentLocationId Criterion.
Definition: ParentLocationRemoteId.php:19
eZ\Publish\Core\REST\Server\Input\Parser\Criterion\ParentLocationRemoteId\$locationService
$locationService
Definition: ParentLocationRemoteId.php:25
eZ\Publish\Core\REST\Server\Input\Parser\Criterion\ParentLocationRemoteId\__construct
__construct(LocationService $locationService)
Definition: ParentLocationRemoteId.php:27
eZ\Publish\Core\REST\Server\Input\Parser\Criterion\ParentLocationRemoteId\parse
parse(array $data, ParsingDispatcher $parsingDispatcher)
Parses input structure to a Criterion object.
Definition: ParentLocationRemoteId.php:42
eZ\Publish\API\Repository\LocationService
Definition: API/Repository/LocationService.php:21
eZ\Publish\Core\REST\Common\Exceptions
Definition: Core/REST/Common/Exceptions/ForbiddenException.php:7
eZ\Publish\Core\REST\Server\Input\Parser\Criterion
Definition: Core/REST/Server/Input/Parser/Criterion/Ancestor.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.