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

SectionInput.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\API\Repository\SectionService;
12 use eZ\Publish\Core\REST\Common\Exceptions;
13
17 class SectionInput extends BaseParser
18 {
24 protected $sectionService;
25
31 public function __construct(SectionService $sectionService)
32 {
33 $this->sectionService = $sectionService;
34 }
35
44 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
45 {
46 $sectionCreate = $this->sectionService->newSectionCreateStruct();
47
48 //@todo XSD says that name is not mandatory? Does that make sense?
49 if (!array_key_exists('name', $data)) {
50 throw new Exceptions\Parser("Missing 'name' attribute for SectionInput.");
51 }
52
53 $sectionCreate->name = $data['name'];
54
55 //@todo XSD says that identifier is not mandatory? Does that make sense?
56 if (!array_key_exists('identifier', $data)) {
57 throw new Exceptions\Parser("Missing 'identifier' attribute for SectionInput.");
58 }
59
60 $sectionCreate->identifier = $data['identifier'];
61
62 return $sectionCreate;
63 }
64 }
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\SectionInput
Parser for SectionInput.
Definition: SectionInput.php:18
eZ\Publish\Core\REST\Server\Input\Parser\SectionInput\__construct
__construct(SectionService $sectionService)
Construct.
Definition: SectionInput.php:31
eZ\Publish\Core\REST\Server\Input\Parser\SectionInput\parse
parse(array $data, ParsingDispatcher $parsingDispatcher)
Parse input structure.
Definition: SectionInput.php:44
eZ\Publish\Core\REST\Server\Input\Parser\SectionInput\$sectionService
$sectionService
Definition: SectionInput.php:24
eZ\Publish\API\Repository\SectionService
Section service, used for section operations.
Definition: API/Repository/SectionService.php:19
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+.