From 72e2578496e6773d099ac84058b7c080374de30c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 31 Mar 2022 17:58:46 +0200 Subject: [PATCH] Fixed route creation based on Content Type status --- .../Output/ValueObjectVisitor/CreatedFieldDefinition.php | 2 +- .../Server/Output/ValueObjectVisitor/FieldDefinitionList.php | 2 +- .../Server/Output/ValueObjectVisitor/RestContentTypeBase.php | 4 ++-- .../Server/Output/ValueObjectVisitor/RestFieldDefinition.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/Server/Output/ValueObjectVisitor/CreatedFieldDefinition.php b/src/lib/Server/Output/ValueObjectVisitor/CreatedFieldDefinition.php index 24a628b2..1f7cc244 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/CreatedFieldDefinition.php +++ b/src/lib/Server/Output/ValueObjectVisitor/CreatedFieldDefinition.php @@ -33,7 +33,7 @@ public function visit(Visitor $visitor, Generator $generator, $data) $visitor->setHeader( 'Location', $this->router->generate( - "ibexa.rest.load_content_type_{$draftUriPart}field_definition", + "ibexa.rest.load_content_type{$draftUriPart}_field_definition", [ 'contentTypeId' => $restFieldDefinition->contentType->id, 'fieldDefinitionId' => $restFieldDefinition->fieldDefinition->id, diff --git a/src/lib/Server/Output/ValueObjectVisitor/FieldDefinitionList.php b/src/lib/Server/Output/ValueObjectVisitor/FieldDefinitionList.php index 51511e2e..c2e670bc 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/FieldDefinitionList.php +++ b/src/lib/Server/Output/ValueObjectVisitor/FieldDefinitionList.php @@ -37,7 +37,7 @@ public function visit(Visitor $visitor, Generator $generator, $data) $generator->startAttribute( 'href', $this->router->generate( - 'ibexa.rest.load_content_type_' . $urlTypeSuffix . 'field_definition_list', + 'ibexa.rest.load_content_type' . $urlTypeSuffix . '_field_definition_list', [ 'contentTypeId' => $contentType->id, ] diff --git a/src/lib/Server/Output/ValueObjectVisitor/RestContentTypeBase.php b/src/lib/Server/Output/ValueObjectVisitor/RestContentTypeBase.php index 3343de1a..9bba8fd3 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RestContentTypeBase.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RestContentTypeBase.php @@ -26,9 +26,9 @@ protected function getUrlTypeSuffix($contentTypeStatus) { switch ($contentTypeStatus) { case Values\ContentType\ContentType::STATUS_DRAFT: - return 'draft_'; + return '_draft'; case Values\ContentType\ContentType::STATUS_MODIFIED: - return 'modified_'; + return '_modified'; case Values\ContentType\ContentType::STATUS_DEFINED: default: return ''; diff --git a/src/lib/Server/Output/ValueObjectVisitor/RestFieldDefinition.php b/src/lib/Server/Output/ValueObjectVisitor/RestFieldDefinition.php index 72d495b3..601bdbab 100644 --- a/src/lib/Server/Output/ValueObjectVisitor/RestFieldDefinition.php +++ b/src/lib/Server/Output/ValueObjectVisitor/RestFieldDefinition.php @@ -56,7 +56,7 @@ public function visit(Visitor $visitor, Generator $generator, $data) $generator->startAttribute( 'href', $this->router->generate( - "ibexa.rest.load_content_type_{$urlTypeSuffix}field_definition", + "ibexa.rest.load_content_type{$urlTypeSuffix}_field_definition", [ 'contentTypeId' => $contentType->id, 'fieldDefinitionId' => $fieldDefinition->id,