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

Publish/Core/REST/Server/Output/ValueObjectVisitor/ContentTypeGroup.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor;
8
9 use eZ\Publish\Core\REST\Common\Output\ValueObjectVisitor;
10 use eZ\Publish\Core\REST\Common\Output\Generator;
11 use eZ\Publish\Core\REST\Common\Output\Visitor;
12 use eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup as ContentTypeGroupValue;
13
17 class ContentTypeGroup extends ValueObjectVisitor
18 {
26 public function visit(Visitor $visitor, Generator $generator, $data)
27 {
28 $generator->startObjectElement('ContentTypeGroup');
29 $this->visitContentTypeGroupAttributes($visitor, $generator, $data);
30 $generator->endObjectElement('ContentTypeGroup');
31 }
32
33 protected function visitContentTypeGroupAttributes(Visitor $visitor, Generator $generator, ContentTypeGroupValue $data)
34 {
35 $visitor->setHeader('Content-Type', $generator->getMediaType('ContentTypeGroup'));
36 $visitor->setHeader('Accept-Patch', $generator->getMediaType('ContentTypeGroupInput'));
37
38 $generator->startAttribute(
39 'href',
40 $this->router->generate(
41 'ezpublish_rest_loadContentTypeGroup',
42 ['contentTypeGroupId' => $data->id]
43 )
44 );
45 $generator->endAttribute('href');
46
47 $generator->startValueElement('id', $data->id);
48 $generator->endValueElement('id');
49
50 $generator->startValueElement('identifier', $data->identifier);
51 $generator->endValueElement('identifier');
52
53 $generator->startValueElement('created', $data->creationDate->format('c'));
54 $generator->endValueElement('created');
55
56 $generator->startValueElement('modified', $data->modificationDate->format('c'));
57 $generator->endValueElement('modified');
58
59 $generator->startObjectElement('Creator', 'User');
60 $generator->startAttribute(
61 'href',
62 $this->router->generate('ezpublish_rest_loadUser', ['userId' => $data->creatorId])
63 );
64 $generator->endAttribute('href');
65 $generator->endObjectElement('Creator');
66
67 $generator->startObjectElement('Modifier', 'User');
68 $generator->startAttribute(
69 'href',
70 $this->router->generate('ezpublish_rest_loadUser', ['userId' => $data->modifierId])
71 );
72 $generator->endAttribute('href');
73 $generator->endObjectElement('Modifier');
74
75 $generator->startObjectElement('ContentTypes', 'ContentTypeInfoList');
76 $generator->startAttribute(
77 'href',
78 $this->router->generate(
79 'ezpublish_rest_listContentTypesForGroup',
80 ['contentTypeGroupId' => $data->id]
81 )
82 );
83 $generator->endAttribute('href');
84 $generator->endObjectElement('ContentTypes');
85 }
86 }
eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup
Definition: Publish/API/Repository/Values/ContentType/ContentTypeGroup.php:24
eZ\Publish\Core\REST\Common\Output\Generator
Output generator.
Definition: REST/Common/Output/Generator.php:13
eZ\Publish\Core\REST\Common\Output\ValueObjectVisitor
Basic ValueObjectVisitor.
Definition: ValueObjectVisitor.php:18
eZ\Publish\Core\REST\Common\Output\Visitor
Visits a value object into an HTTP Response.
Definition: Visitor.php:15
eZ\Publish\Core\REST\Common\Output\Visitor\setHeader
setHeader($name, $value)
Set HTTP response header.
Definition: Visitor.php:64
eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ContentTypeGroup
ContentTypeGroup value object visitor.
Definition: Publish/Core/REST/Server/Output/ValueObjectVisitor/ContentTypeGroup.php:18
eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ContentTypeGroup\visitContentTypeGroupAttributes
visitContentTypeGroupAttributes(Visitor $visitor, Generator $generator, ContentTypeGroupValue $data)
Definition: Publish/Core/REST/Server/Output/ValueObjectVisitor/ContentTypeGroup.php:33
eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ContentTypeGroup\visit
visit(Visitor $visitor, Generator $generator, $data)
Visit struct returned by controllers.
Definition: Publish/Core/REST/Server/Output/ValueObjectVisitor/ContentTypeGroup.php:26
eZ\Publish\Core\REST\Common\Output\ValueObjectVisitor
Definition: Common/Output/ValueObjectVisitor/ContentObjectStates.php:7
eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor
Definition: Output/ValueObjectVisitor/BadRequestException.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.