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

ObjectStateGroupUpdate.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\Input\ParserTools;
12 use eZ\Publish\Core\REST\Common\Exceptions;
13 use eZ\Publish\API\Repository\ObjectStateService;
14
18 class ObjectStateGroupUpdate extends BaseParser
19 {
25 protected $objectStateService;
26
28 protected $parserTools;
29
36 public function __construct(ObjectStateService $objectStateService, ParserTools $parserTools)
37 {
38 $this->objectStateService = $objectStateService;
39 $this->parserTools = $parserTools;
40 }
41
50 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
51 {
52 $objectStateGroupUpdateStruct = $this->objectStateService->newObjectStateGroupUpdateStruct();
53
54 if (array_key_exists('identifier', $data)) {
55 $objectStateGroupUpdateStruct->identifier = $data['identifier'];
56 }
57
58 if (array_key_exists('defaultLanguageCode', $data)) {
59 $objectStateGroupUpdateStruct->defaultLanguageCode = $data['defaultLanguageCode'];
60 }
61
62 if (array_key_exists('names', $data)) {
63 if (!is_array($data['names'])) {
64 throw new Exceptions\Parser("Missing or invalid 'names' element for ObjectStateGroupUpdate.");
65 }
66
67 if (!array_key_exists('value', $data['names']) || !is_array($data['names']['value'])) {
68 throw new Exceptions\Parser("Missing or invalid 'names' element for ObjectStateGroupUpdate.");
69 }
70
71 $objectStateGroupUpdateStruct->names = $this->parserTools->parseTranslatableList($data['names']);
72 }
73
74 if (array_key_exists('descriptions', $data) && is_array($data['descriptions'])) {
75 $objectStateGroupUpdateStruct->descriptions = $this->parserTools->parseTranslatableList($data['descriptions']);
76 }
77
78 return $objectStateGroupUpdateStruct;
79 }
80 }
eZ\Publish\Core\REST\Common\Input\BaseParser
Definition: BaseParser.php:12
eZ\Publish\Core\REST\Common\Input\ParserTools
Tools object to be used in Input Parsers.
Definition: ParserTools.php:17
eZ\Publish\Core\REST\Common\Input\ParsingDispatcher
Parsing dispatcher.
Definition: ParsingDispatcher.php:15
eZ\Publish\Core\REST\Server\Input\Parser\ObjectStateGroupUpdate
Parser for ObjectStateGroupUpdate.
Definition: ObjectStateGroupUpdate.php:19
eZ\Publish\Core\REST\Server\Input\Parser\ObjectStateGroupUpdate\$objectStateService
$objectStateService
Definition: ObjectStateGroupUpdate.php:25
eZ\Publish\Core\REST\Server\Input\Parser\ObjectStateGroupUpdate\__construct
__construct(ObjectStateService $objectStateService, ParserTools $parserTools)
Construct.
Definition: ObjectStateGroupUpdate.php:36
eZ\Publish\Core\REST\Server\Input\Parser\ObjectStateGroupUpdate\parse
parse(array $data, ParsingDispatcher $parsingDispatcher)
Parse input structure.
Definition: ObjectStateGroupUpdate.php:50
eZ\Publish\Core\REST\Server\Input\Parser\ObjectStateGroupUpdate\$parserTools
$parserTools
Definition: ObjectStateGroupUpdate.php:28
eZ\Publish\API\Repository\ObjectStateService
Definition: API/Repository/ObjectStateService.php:23
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+.