Skip to content

Commit

Permalink
IBX-8536: Replaced deprecated graphql methods (#31)
Browse files Browse the repository at this point in the history
* IBX-8536: Replaced deprecated graphql methods

* Dropped deprecated interface

* Dropped deprecated factory method

* Cleanup constructor

* fix cs

* fixed spec
  • Loading branch information
ViniTou authored Oct 23, 2024
1 parent cfc6043 commit 87c5596
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 50 deletions.
2 changes: 1 addition & 1 deletion spec/GraphQL/ContentQueryFieldDefinitionMapperSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 1 addition & 8 deletions spec/QueryFieldServiceSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -39,7 +38,6 @@ class QueryFieldServiceSpec extends ObjectBehavior
public function let(
SearchService $searchService,
ContentTypeService $contentTypeService,
LocationService $locationService,
QueryTypeRegistry $queryTypeRegistry,
QueryType $queryType
) {
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions src/lib/GraphQL/ContentQueryFieldDefinitionMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
17 changes: 0 additions & 17 deletions src/lib/QueryFieldPaginationService.php

This file was deleted.

8 changes: 0 additions & 8 deletions src/lib/QueryFieldService.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
namespace 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\Content;
use Ibexa\Contracts\Core\Repository\Values\Content\Location;
Expand Down Expand Up @@ -36,20 +35,13 @@ final class QueryFieldService implements QueryFieldServiceInterface, QueryFieldL
/** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */
private $contentTypeService;

/**
* @var \Ibexa\Contracts\Core\Repository\LocationService
*/
private $locationService;

public function __construct(
SearchService $searchService,
ContentTypeService $contentTypeService,
LocationService $locationService,
QueryTypeRegistry $queryTypeRegistry
) {
$this->searchService = $searchService;
$this->contentTypeService = $contentTypeService;
$this->locationService = $locationService;
$this->queryTypeRegistry = $queryTypeRegistry;
}

Expand Down

0 comments on commit 87c5596

Please sign in to comment.