From 87c559676d55b16b6a9109de4d41e676367a7084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Parafi=C5=84ski?= Date: Wed, 23 Oct 2024 13:11:36 +0200 Subject: [PATCH] IBX-8536: Replaced deprecated graphql methods (#31) * IBX-8536: Replaced deprecated graphql methods * Dropped deprecated interface * Dropped deprecated factory method * Cleanup constructor * fix cs * fixed spec --- .../ContentQueryFieldDefinitionMapperSpec.php | 2 +- spec/QueryFieldServiceSpec.php | 9 +-------- .../ContentQueryFieldDefinitionMapper.php | 4 ++-- .../FieldValue/Converter/QueryConverter.php | 14 -------------- src/lib/QueryFieldPaginationService.php | 17 ----------------- src/lib/QueryFieldService.php | 8 -------- 6 files changed, 4 insertions(+), 50 deletions(-) delete mode 100644 src/lib/QueryFieldPaginationService.php diff --git a/spec/GraphQL/ContentQueryFieldDefinitionMapperSpec.php b/spec/GraphQL/ContentQueryFieldDefinitionMapperSpec.php index c696fc8..b21b17d 100644 --- a/spec/GraphQL/ContentQueryFieldDefinitionMapperSpec.php +++ b/spec/GraphQL/ContentQueryFieldDefinitionMapperSpec.php @@ -34,7 +34,7 @@ public function let( ->willReturn($contentType); $nameHelper - ->domainContentName($contentType) + ->itemName($contentType) ->willReturn(self::GRAPHQL_TYPE); $this->beConstructedWith($innerMapper, $nameHelper, $contentTypeService, self::FIELD_TYPE_IDENTIFIER); diff --git a/spec/QueryFieldServiceSpec.php b/spec/QueryFieldServiceSpec.php index a3c1071..aa6c604 100644 --- a/spec/QueryFieldServiceSpec.php +++ b/spec/QueryFieldServiceSpec.php @@ -8,7 +8,6 @@ namespace spec\Ibexa\FieldTypeQuery; use Ibexa\Contracts\Core\Repository\ContentTypeService; -use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\SearchService; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Query as ApiContentQuery; @@ -39,7 +38,6 @@ class QueryFieldServiceSpec extends ObjectBehavior public function let( SearchService $searchService, ContentTypeService $contentTypeService, - LocationService $locationService, QueryTypeRegistry $queryTypeRegistry, QueryType $queryType ) { @@ -51,22 +49,17 @@ public function let( 'param2' => 'value2', ]; - $location = new Values\Content\Location([ - 'id' => self::LOCATION_ID, - ]); - $contentTypeWithPagination = $this->getContentType($parameters); $contentTypeService->loadContentType(self::CONTENT_TYPE_ID)->willReturn($contentTypeWithPagination); $contentTypeWithoutPagination = $this->getContentType($parameters, false, 10); $contentTypeService->loadContentType(self::CONTENT_TYPE_ID_WITHOUT_PAGINATION)->willReturn($contentTypeWithoutPagination); - $locationService->loadLocation(self::LOCATION_ID)->willReturn($location); $queryTypeRegistry->getQueryType(self::QUERY_TYPE_IDENTIFIER)->willReturn($queryType); $queryType->getQuery(Argument::any())->willReturn(new ApiQuery()); // @todo this should fail. It does not. $searchService->findContent(Argument::any())->willReturn($this->searchResult); - $this->beConstructedWith($searchService, $contentTypeService, $locationService, $queryTypeRegistry); + $this->beConstructedWith($searchService, $contentTypeService, $queryTypeRegistry); } public function it_is_initializable() diff --git a/src/lib/GraphQL/ContentQueryFieldDefinitionMapper.php b/src/lib/GraphQL/ContentQueryFieldDefinitionMapper.php index 093ac96..beb09da 100644 --- a/src/lib/GraphQL/ContentQueryFieldDefinitionMapper.php +++ b/src/lib/GraphQL/ContentQueryFieldDefinitionMapper.php @@ -95,14 +95,14 @@ protected function getFieldTypeIdentifier(): string private function nameValueType($typeIdentifier): string { - return $this->nameHelper->domainContentName( + return $this->nameHelper->itemName( $this->contentTypeService->loadContentTypeByIdentifier($typeIdentifier) ); } private function nameValueConnectionType($typeIdentifier): string { - return $this->nameHelper->domainContentConnection( + return $this->nameHelper->itemConnectionName( $this->contentTypeService->loadContentTypeByIdentifier($typeIdentifier) ); } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/QueryConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/QueryConverter.php index 32bd2b7..f839d71 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/QueryConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/QueryConverter.php @@ -15,20 +15,6 @@ class QueryConverter implements Converter { - /** - * Factory for current class. - * - * Note: Class should instead be configured as service if it gains dependencies. - * - * @deprecated since 6.8, will be removed in 7.x, use default constructor instead. - * - * @return \Ibexa\FieldTypeQuery\Persistence\Legacy\Content\FieldValue\Converter\QueryConverter - */ - public static function create() - { - return new self(); - } - /** * Converts data from $value to $storageFieldValue. * diff --git a/src/lib/QueryFieldPaginationService.php b/src/lib/QueryFieldPaginationService.php deleted file mode 100644 index 76c9144..0000000 --- a/src/lib/QueryFieldPaginationService.php +++ /dev/null @@ -1,17 +0,0 @@ -searchService = $searchService; $this->contentTypeService = $contentTypeService; - $this->locationService = $locationService; $this->queryTypeRegistry = $queryTypeRegistry; }