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

RelationCreate.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Server\Input\Parser;
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
16 class RelationCreate extends BaseParser
17 {
26 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
27 {
28 if (!array_key_exists('Destination', $data) || !is_array($data['Destination'])) {
29 throw new Exceptions\Parser("Missing or invalid 'Destination' element for RelationCreate.");
30 }
31
32 if (!array_key_exists('_href', $data['Destination'])) {
33 throw new Exceptions\Parser("Missing '_href' attribute for Destination element in RelationCreate.");
34 }
35
36 return $this->requestParser->parseHref($data['Destination']['_href'], 'contentId');
37 }
38 }
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\RelationCreate
Parser for RelationCreate.
Definition: RelationCreate.php:17
eZ\Publish\Core\REST\Server\Input\Parser\RelationCreate\parse
parse(array $data, ParsingDispatcher $parsingDispatcher)
Parse input structure.
Definition: RelationCreate.php:26
eZ\Publish\Core\REST\Common\Exceptions
Definition: Core/REST/Common/Exceptions/ForbiddenException.php:7
eZ\Publish\Core\REST\Server\Input\Parser
Definition: ContentCreate.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.