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

Output/ValueObjectVisitor/CreatedFieldDefinition.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\Generator;
10 use eZ\Publish\Core\REST\Common\Output\Visitor;
11
17 class CreatedFieldDefinition extends RestFieldDefinition
18 {
26 public function visit(Visitor $visitor, Generator $generator, $data)
27 {
28 $restFieldDefinition = $data->fieldDefinition;
29
30 parent::visit($visitor, $generator, $restFieldDefinition);
31
32 $draftUriPart = $this->getUrlTypeSuffix($restFieldDefinition->contentType->status);
33 $visitor->setHeader(
34 'Location',
35 $this->router->generate(
36 "ezpublish_rest_loadContentType{$draftUriPart}FieldDefinition",
37 [
38 'contentTypeId' => $restFieldDefinition->contentType->id,
39 'fieldDefinitionId' => $restFieldDefinition->fieldDefinition->id,
40 ]
41 )
42 );
43 $visitor->setStatus(201);
44 }
45 }
eZ\Publish\Core\REST\Common\Output\Generator
Output generator.
Definition: REST/Common/Output/Generator.php:13
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\setStatus
setStatus($statusCode)
Sets the given status code in the corresponding header.
Definition: Visitor.php:78
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\CreatedFieldDefinition
CreatedFieldDefinition value object visitor.
Definition: Output/ValueObjectVisitor/CreatedFieldDefinition.php:18
eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\CreatedFieldDefinition\visit
visit(Visitor $visitor, Generator $generator, $data)
Visit struct returned by controllers.
Definition: Output/ValueObjectVisitor/CreatedFieldDefinition.php:26
eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestContentTypeBase\getUrlTypeSuffix
getUrlTypeSuffix($contentTypeStatus)
Returns a suffix for the URL type to generate on basis of the given $contentTypeStatus.
Definition: RestContentTypeBase.php:25
eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestFieldDefinition
RestFieldDefinition value object visitor.
Definition: Output/ValueObjectVisitor/RestFieldDefinition.php:20
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+.