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

Publish/Core/REST/Client/Input/Parser/View.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Client\Input\Parser;
8
9 use eZ\Publish\Core\REST\Common\Input\ParsingDispatcher;
10 use eZ\Publish\Core\REST\Common\Exceptions;
11 use eZ\Publish\API\Repository\Values\Content\Query;
12 use eZ\Publish\Core\REST\Common\Input\BaseParser;
13 use eZ\Publish\Core\REST\Client\Values\View as ViewValue;
14
18 class View extends BaseParser
19 {
30 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
31 {
32 $viewData = [];
33
34 // identifier
35 if (!array_key_exists('identifier', $data)) {
36 throw new Exceptions\Parser('Missing identifier attribute for ViewInput.');
37 }
38 $viewData['identifier'] = $data['identifier'];
39
40 // query
41 if (array_key_exists('ContentQuery', $data) && is_array($data['ContentQuery'])) {
42 $viewData['query'] = $parsingDispatcher->parse($data['Query'], 'application/vnd.ez.api.internal.ContentQuery');
43 }
44
45 elseif (array_key_exists('LocationQuery', $data) && is_array($data['LocationQuery'])) {
46 $viewData['query'] = $parsingDispatcher->parse($data['LocationQuery'], 'application/vnd.ez.api.internal.LocationQuery');
47 }
48
49 elseif (array_key_exists('Query', $data) && is_array($data['Query'])) {
50 $viewData['query'] = $parsingDispatcher->parse($data['Query'], 'application/vnd.ez.api.internal.ContentQuery');
51 }
52
53 else {
54 throw new Exceptions\Parser('Missing or invalid LocationQuery or ContentQuery attribute for View.');
55 }
56
57 // results
58 $viewData['result'] = $parsingDispatcher->parse($data['Result'], $data['Result']['_media-type']);
59
60 return new ViewValue($viewData);
61 }
62 }
eZ\Publish\API\Repository\Values\Content\Query
This class is used to perform a Content query.
Definition: API/Repository/Values/Content/Query.php:15
eZ\Publish\Core\REST\Client\Input\Parser\View
Parser for View.
Definition: Publish/Core/REST/Client/Input/Parser/View.php:19
eZ\Publish\Core\REST\Client\Input\Parser\View\parse
parse(array $data, ParsingDispatcher $parsingDispatcher)
Parses input structure to a RestViewInput struct.
Definition: Publish/Core/REST/Client/Input/Parser/View.php:30
eZ\Publish\Core\REST\Client\Values\View
Definition: Publish/Core/REST/Client/Values/View.php:19
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\Common\Input\ParsingDispatcher\parse
parse(array $data, $mediaType)
Parses the given $data according to $mediaType.
Definition: ParsingDispatcher.php:66
eZ\Publish\Core\REST\Client\Input\Parser
Definition: Publish/Core/REST/Client/Input/Parser/Content.php:7
eZ\Publish\Core\REST\Common\Exceptions
Definition: Core/REST/Common/Exceptions/ForbiddenException.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.