diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b3c99fd..1e8ff85 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,7 +42,6 @@ jobs: fail-fast: false matrix: php: - - '7.3' - '7.4' - '8.0' composer_options: [ "" ] diff --git a/src/Schema/Domain/Content/Mapper/FieldDefinition/UrlFieldDefinitionMapper.php b/src/Schema/Domain/Content/Mapper/FieldDefinition/UrlFieldDefinitionMapper.php index 3730c90..1baaae3 100644 --- a/src/Schema/Domain/Content/Mapper/FieldDefinition/UrlFieldDefinitionMapper.php +++ b/src/Schema/Domain/Content/Mapper/FieldDefinition/UrlFieldDefinitionMapper.php @@ -6,58 +6,46 @@ */ namespace Ibexa\GraphQL\Schema\Domain\Content\Mapper\FieldDefinition; +use EzSystems\EzPlatformGraphQL\Schema\Domain\Content\Mapper\FieldDefinition\DecoratingFieldDefinitionMapper; use EzSystems\EzPlatformGraphQL\Schema\Domain\Content\Mapper\FieldDefinition\FieldDefinitionMapper; -use eZ\Publish\API\Repository\Values\ContentType\ContentType; use eZ\Publish\API\Repository\Values\ContentType\FieldDefinition; -class UrlFieldDefinitionMapper implements FieldDefinitionMapper +class UrlFieldDefinitionMapper extends DecoratingFieldDefinitionMapper implements FieldDefinitionMapper { private const FIELD_TYPE_IDENTIFIER = 'ezurl'; - private FieldDefinitionMapper $innerMapper; private bool $shouldExtendUrlInputType; - public function __construct(FieldDefinitionMapper $innerMapper, bool $shouldExtendUrlInputType) - { - $this->innerMapper = $innerMapper; + public function __construct( + FieldDefinitionMapper $innerMapper, + bool $shouldExtendUrlInputType + ) { + parent::__construct($innerMapper); $this->shouldExtendUrlInputType = $shouldExtendUrlInputType; } - public function mapToFieldDefinitionType(FieldDefinition $fieldDefinition): string - { - return $this->innerMapper->mapToFieldDefinitionType($fieldDefinition); - } - public function mapToFieldValueType(FieldDefinition $fieldDefinition): string { - $type = $this->innerMapper->mapToFieldValueType($fieldDefinition); - if ($fieldDefinition->fieldTypeIdentifier === self::FIELD_TYPE_IDENTIFIER) { - if ($this->shouldExtendUrlInputType) { - $type = 'UrlFieldValue'; - } else { - @trigger_error( - 'The return type `string` for the URL field has been deprecated since version 3.3 ' . - 'and will be removed in version 5.0. To start receiving `UrlFieldInput` instead of the deprecated ' . - '`string`, set the parameter `ibexa.graphql.schema.should.extend.ezurl` to `true`.', - E_USER_DEPRECATED - ); - } + $type = parent::mapToFieldValueType($fieldDefinition); + if (!$this->canMap($fieldDefinition)) { + return $type; } - return $type; - } - - public function mapToFieldValueResolver(FieldDefinition $fieldDefinition): string - { - return $this->innerMapper->mapToFieldValueResolver($fieldDefinition); - } + if ($this->shouldExtendUrlInputType) { + $type = 'UrlFieldValue'; + } else { + @trigger_error( + 'The return type `string` for the URL field has been deprecated since version 3.3 ' . + 'and will be removed in version 5.0. To start receiving `UrlFieldInput` instead of the deprecated ' . + '`string`, set the parameter `ibexa.graphql.schema.should.extend.ezurl` to `true`.', + E_USER_DEPRECATED + ); + } - public function mapToFieldValueInputType(ContentType $contentType, FieldDefinition $fieldDefinition): ?string - { - return $this->innerMapper->mapToFieldValueInputType($contentType, $fieldDefinition); + return $type; } - public function mapToFieldValueArgsBuilder(FieldDefinition $fieldDefinition): ?string + protected function getFieldTypeIdentifier(): string { - return $this->innerMapper->mapToFieldValueArgsBuilder($fieldDefinition); + return self::FIELD_TYPE_IDENTIFIER; } }