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

Core/REST/Client/Input/Parser/ContentInfo.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\ParserTools;
10 use eZ\Publish\Core\REST\Common\Input\BaseParser;
11 use eZ\Publish\Core\REST\Common\Input\ParsingDispatcher;
12 use eZ\Publish\Core\REST\Client\Values;
13 use eZ\Publish\API\Repository\ContentTypeService;
14
18 class ContentInfo extends BaseParser
19 {
21 protected $parserTools;
22
24 protected $contentTypeService;
25
30 public function __construct(ParserTools $parserTools, ContentTypeService $contentTypeService)
31 {
32 $this->parserTools = $parserTools;
33 $this->contentTypeService = $contentTypeService;
34 }
35
49 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
50 {
51 $contentTypeId = $this->parserTools->parseObjectElement($data['ContentType'], $parsingDispatcher);
52 $ownerId = $this->parserTools->parseObjectElement($data['Owner'], $parsingDispatcher);
53 $mainLocationId = $this->parserTools->parseObjectElement($data['MainLocation'], $parsingDispatcher);
54 $sectionId = $this->parserTools->parseObjectElement($data['Section'], $parsingDispatcher);
55
56 $locationListReference = $this->parserTools->parseObjectElement($data['Locations'], $parsingDispatcher);
57 $versionListReference = $this->parserTools->parseObjectElement($data['Versions'], $parsingDispatcher);
58 $currentVersionReference = $this->parserTools->parseObjectElement($data['CurrentVersion'], $parsingDispatcher);
59
60 if (isset($data['CurrentVersion']['Version'])) {
61 $this->parserTools->parseObjectElement($data['CurrentVersion']['Version'], $parsingDispatcher);
62 }
63
64 return new Values\RestContentInfo(
65 array(
66 'id' => $data['_href'],
67 'name' => $data['Name'],
68 'contentTypeId' => $contentTypeId,
69 'ownerId' => $ownerId,
70 'modificationDate' => new \DateTime($data['lastModificationDate']),
71
72 'publishedDate' => ($publishedDate = (!empty($data['publishedDate'])
73 ? new \DateTime($data['publishedDate'])
74 : null)),
75
76 'published' => ($publishedDate !== null),
77 'alwaysAvailable' => (strtolower($data['alwaysAvailable']) === 'true'),
78 'remoteId' => $data['_remoteId'],
79 'mainLanguageCode' => $data['mainLanguageCode'],
80 'mainLocationId' => $mainLocationId,
81 'sectionId' => $sectionId,
82
83 'versionListReference' => $versionListReference,
84 'locationListReference' => $locationListReference,
85 'currentVersionReference' => $currentVersionReference,
86 )
87 );
88 }
89 }
eZ\Publish\API\Repository\Values\Content\ContentInfo
Definition: API/Repository/Values/Content/ContentInfo.php:31
eZ\Publish\API\Repository\Values\Content\ContentInfo\$ownerId
$ownerId
Definition: API/Repository/Values/Content/ContentInfo.php:86
eZ\Publish\API\Repository\Values\Content\ContentInfo\$contentTypeId
$contentTypeId
Definition: API/Repository/Values/Content/ContentInfo.php:48
eZ\Publish\API\Repository\Values\Content\ContentInfo\$mainLocationId
$mainLocationId
Definition: API/Repository/Values/Content/ContentInfo.php:131
eZ\Publish\API\Repository\Values\Content\ContentInfo\$sectionId
$sectionId
Definition: API/Repository/Values/Content/ContentInfo.php:64
eZ\Publish\API\Repository\Values\Content\ContentInfo\$publishedDate
$publishedDate
Definition: API/Repository/Values/Content/ContentInfo.php:100
eZ\Publish\Core\REST\Client\Input\Parser\ContentInfo\__construct
__construct(ParserTools $parserTools, ContentTypeService $contentTypeService)
Definition: Core/REST/Client/Input/Parser/ContentInfo.php:30
eZ\Publish\Core\REST\Client\Input\Parser\ContentInfo\$contentTypeService
$contentTypeService
Definition: Core/REST/Client/Input/Parser/ContentInfo.php:24
eZ\Publish\Core\REST\Client\Input\Parser\ContentInfo\$parserTools
$parserTools
Definition: Core/REST/Client/Input/Parser/ContentInfo.php:21
eZ\Publish\Core\REST\Client\Input\Parser\ContentInfo\parse
parse(array $data, ParsingDispatcher $parsingDispatcher)
Parse input structure.
Definition: Core/REST/Client/Input/Parser/ContentInfo.php:49
eZ\Publish\Core\REST\Client\Values\RestContentInfo
Subset of ContentInfo submitted by REST + some info submitted in addition.
Definition: RestContentInfo.php:15
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\$parserTools
$parserTools
Definition: common.php:120
eZ\Publish\API\Repository\ContentTypeService
Definition: API/Repository/ContentTypeService.php:25
eZ\Publish\Core\REST\Client\Input\Parser
Definition: Publish/Core/REST/Client/Input/Parser/Content.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.