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

Common/Output/ValueObjectVisitor/ContentObjectStates.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Common\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
16 class ContentObjectStates extends ValueObjectVisitor
17 {
25 public function visit(Visitor $visitor, Generator $generator, $data)
26 {
27 $generator->startObjectElement('ContentObjectStates');
28 $visitor->setHeader('Content-Type', $generator->getMediaType('ContentObjectStates'));
29 $visitor->setHeader('Accept-Patch', $generator->getMediaType('ContentObjectStates'));
30
31 $generator->startList('ObjectState');
32
33 foreach ($data->states as $state) {
34 $generator->startObjectElement('ObjectState');
35 $generator->startAttribute(
36 'href',
37 $this->router->generate(
38 'ezpublish_rest_loadObjectState',
39 [
40 'objectStateGroupId' => $state->groupId,
41 'objectStateId' => $state->objectState->id,
42 ]
43 )
44 );
45 $generator->endAttribute('href');
46 $generator->endObjectElement('ObjectState');
47 }
48
49 $generator->endList('ObjectState');
50
51 $generator->endObjectElement('ContentObjectStates');
52 }
53 }
eZ\Publish\Core\REST\Common\Output\Generator
Output generator.
Definition: REST/Common/Output/Generator.php:13
eZ\Publish\Core\REST\Common\Output\ValueObjectVisitor\ContentObjectStates
ContentObjectStates value object visitor.
Definition: Common/Output/ValueObjectVisitor/ContentObjectStates.php:17
eZ\Publish\Core\REST\Common\Output\ValueObjectVisitor\ContentObjectStates\visit
visit(Visitor $visitor, Generator $generator, $data)
Visit struct returned by controllers.
Definition: Common/Output/ValueObjectVisitor/ContentObjectStates.php:25
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\Common\Output\ValueObjectVisitor
Definition: Common/Output/ValueObjectVisitor/ContentObjectStates.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.