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

Core/REST/Server/Output/ValueObjectVisitor/ObjectStateGroup.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\ObjectState\ObjectStateGroup as ObjectStateGroupValue;
13
17 class ObjectStateGroup extends ValueObjectVisitor
18 {
26 public function visit(Visitor $visitor, Generator $generator, $data)
27 {
28 $generator->startObjectElement('ObjectStateGroup');
29 $visitor->setHeader('Content-Type', $generator->getMediaType('ObjectStateGroup'));
30 $visitor->setHeader('Accept-Patch', $generator->getMediaType('ObjectStateGroupUpdate'));
31 $this->visitObjectStateGroupAttributes($visitor, $generator, $data);
32 $generator->endObjectElement('ObjectStateGroup');
33 }
34
35 protected function visitObjectStateGroupAttributes(Visitor $visitor, Generator $generator, ObjectStateGroupValue $data)
36 {
37 $generator->startAttribute(
38 'href',
39 $this->router->generate('ezpublish_rest_loadObjectStateGroup', ['objectStateGroupId' => $data->id])
40 );
41 $generator->endAttribute('href');
42
43 $generator->startValueElement('id', $data->id);
44 $generator->endValueElement('id');
45
46 $generator->startValueElement('identifier', $data->identifier);
47 $generator->endValueElement('identifier');
48
49 $generator->startValueElement('defaultLanguageCode', $data->defaultLanguageCode);
50 $generator->endValueElement('defaultLanguageCode');
51
52 $generator->startValueElement('languageCodes', implode(',', $data->languageCodes));
53 $generator->endValueElement('languageCodes');
54
55 $generator->startObjectElement('ObjectStates', 'ObjectStateList');
56 $generator->startAttribute(
57 'href',
58 $this->router->generate('ezpublish_rest_loadObjectStates', ['objectStateGroupId' => $data->id])
59 );
60 $generator->endAttribute('href');
61 $generator->endObjectElement('ObjectStates');
62
63 $this->visitNamesList($generator, $data->getNames());
64 $this->visitDescriptionsList($generator, $data->getDescriptions());
65 }
66 }
eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup
Definition: API/Repository/Values/ObjectState/ObjectStateGroup.php:22
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\ValueObjectVisitor\visitNamesList
visitNamesList(Generator $generator, array $names)
Visits the given list of $names.
Definition: ValueObjectVisitor.php:78
eZ\Publish\Core\REST\Common\Output\ValueObjectVisitor\visitDescriptionsList
visitDescriptionsList(Generator $generator, array $descriptions)
Visits the given list of $descriptions.
Definition: ValueObjectVisitor.php:89
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\ObjectStateGroup
ObjectStateGroup value object visitor.
Definition: Core/REST/Server/Output/ValueObjectVisitor/ObjectStateGroup.php:18
eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ObjectStateGroup\visit
visit(Visitor $visitor, Generator $generator, $data)
Visit struct returned by controllers.
Definition: Core/REST/Server/Output/ValueObjectVisitor/ObjectStateGroup.php:26
eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ObjectStateGroup\visitObjectStateGroupAttributes
visitObjectStateGroupAttributes(Visitor $visitor, Generator $generator, ObjectStateGroupValue $data)
Definition: Core/REST/Server/Output/ValueObjectVisitor/ObjectStateGroup.php:35
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+.