Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-8536: Removed deprecations in graphql #71

Merged
merged 4 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/domain_schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Another, `AddDomainContentToDomainGroup`, will add the same Domain Content to it

### Custom Field Types

Fields values are handled by the `AddFieldValueToDomainContent` content domain schema worker. It uses Field Value Builders (instances of `Schema\Domain\Content\FieldValueBuilder\FieldValueBuilder`) to generate the type and resolution for each field.
Fields values are handled by the `AddFieldValueToItem` content domain schema worker. It uses Field Value Builders (instances of `Schema\Domain\Content\FieldValueBuilder\FieldValueBuilder`) to generate the type and resolution for each field.

Basic field types are handled by the `BaseFieldValueBuilder`. It maps each fieldtype, using its identifier, to either a type, or a type and a resolver. For the time being, it can not be customized.

Expand Down
15 changes: 6 additions & 9 deletions doc/howto/custom_field_type.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class RelationFieldDefinitionMapper extends DecoratingFieldDefinitionMapper impl

if (count($settings['selectionContentTypes']) === 1) {
$contentType = $this->contentTypeService->loadContentTypeByIdentifier($settings['selectionContentTypes'][0]);
$type = $this->nameHelper->domainContentName($contentType);
$type = $this->nameHelper->itemName($contentType);
} else {
$type = 'DomainContent';
}
Expand Down Expand Up @@ -160,15 +160,14 @@ class RelationFieldDefinitionMapper extends DecoratingFieldDefinitionMapper impl
}
```

#### Field Definition Input Mappers
As of v1.0.4, an extra interface is available for mutation input type handling, `FieldDefinitionInputMapper`.
It is used if the input for this field depends on the field definition. For instance, `ezmatrix`
generates its own input types depending on the configured columns. It defines an extra method, `mapToFieldValueInputType`,
that returns a GraphQL type for a Field Definition.
#### Mutation input type handling
If the input for a field depends on the field definition, like `ezmatrix`
which generates its own input types depending on the configured columns, use `mapToFieldValueInputType`
which returns a GraphQL type for a Field Definition.

Example:
```
class MyFieldDefinitionMapper extends DecoratingFieldDefinitionMapper implements FieldDefinitionMapper, FieldDefinitionInputMapper
class MyFieldDefinitionMapper extends DecoratingFieldDefinitionMapper implements FieldDefinitionMapper
{
public function mapToFieldValueInputType(ContentType $contentType, FieldDefinition $fieldDefinition): ?string
{
Expand All @@ -181,8 +180,6 @@ class MyFieldDefinitionMapper extends DecoratingFieldDefinitionMapper implements
}
```

In 2.0, `FieldDefinitionInputMapper` and `FieldDefinitionMapper` will be merged, and the service tag will be deprecated.

## Resolver expressions
Two variables are available in the resolver's expression:

Expand Down
95 changes: 0 additions & 95 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -855,21 +855,6 @@ parameters:
count: 1
path: src/lib/Resolver/DomainContentResolver.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Resolver\\\\DomainContentResolver\\:\\:resolveDomainFieldValue\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Resolver/DomainContentResolver.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Resolver\\\\DomainContentResolver\\:\\:resolveDomainFieldValue\\(\\) has parameter \\$args with no type specified\\.$#"
count: 1
path: src/lib/Resolver/DomainContentResolver.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Resolver\\\\DomainContentResolver\\:\\:resolveDomainFieldValue\\(\\) has parameter \\$fieldDefinitionIdentifier with no type specified\\.$#"
count: 1
path: src/lib/Resolver/DomainContentResolver.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Resolver\\\\DomainContentResolver\\:\\:resolveDomainRelationFieldValue\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -1180,11 +1165,6 @@ parameters:
count: 1
path: src/lib/Resolver/SearchResolver.php

-
message: "#^Property Ibexa\\\\GraphQL\\\\Resolver\\\\SearchResolver\\:\\:\\$searchService is never read, only written\\.$#"
count: 1
path: src/lib/Resolver/SearchResolver.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Resolver\\\\SectionResolver\\:\\:resolveSectionById\\(\\) has parameter \\$sectionId with no type specified\\.$#"
count: 1
Expand Down Expand Up @@ -1610,71 +1590,6 @@ parameters:
count: 1
path: src/lib/Schema/Domain/Content/NameHelper.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\Domain\\\\Content\\\\NameHelper\\:\\:domainContentCollectionField\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Schema/Domain/Content/NameHelper.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\Domain\\\\Content\\\\NameHelper\\:\\:domainContentConnection\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Schema/Domain/Content/NameHelper.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\Domain\\\\Content\\\\NameHelper\\:\\:domainContentConnection\\(\\) has parameter \\$contentType with no type specified\\.$#"
count: 1
path: src/lib/Schema/Domain/Content/NameHelper.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\Domain\\\\Content\\\\NameHelper\\:\\:domainContentCreateInputName\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Schema/Domain/Content/NameHelper.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\Domain\\\\Content\\\\NameHelper\\:\\:domainContentField\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Schema/Domain/Content/NameHelper.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\Domain\\\\Content\\\\NameHelper\\:\\:domainContentName\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Schema/Domain/Content/NameHelper.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\Domain\\\\Content\\\\NameHelper\\:\\:domainContentTypeName\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Schema/Domain/Content/NameHelper.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\Domain\\\\Content\\\\NameHelper\\:\\:domainContentUpdateInputName\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Schema/Domain/Content/NameHelper.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\Domain\\\\Content\\\\NameHelper\\:\\:domainGroupField\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Schema/Domain/Content/NameHelper.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\Domain\\\\Content\\\\NameHelper\\:\\:domainGroupName\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Schema/Domain/Content/NameHelper.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\Domain\\\\Content\\\\NameHelper\\:\\:domainGroupTypesName\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Schema/Domain/Content/NameHelper.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\Domain\\\\Content\\\\NameHelper\\:\\:domainMutationCreateContentField\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Schema/Domain/Content/NameHelper.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\Domain\\\\Content\\\\NameHelper\\:\\:domainMutationUpdateContentField\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Schema/Domain/Content/NameHelper.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\Domain\\\\Content\\\\NameHelper\\:\\:fieldDefinitionField\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -2255,16 +2170,6 @@ parameters:
count: 1
path: src/lib/Schema/Generator.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\ImagesVariationsBuilder\\:\\:build\\(\\) has no return type specified\\.$#"
count: 1
path: src/lib/Schema/ImagesVariationsBuilder.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\ImagesVariationsBuilder\\:\\:build\\(\\) has parameter \\$schema with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Schema/ImagesVariationsBuilder.php

-
message: "#^Method Ibexa\\\\GraphQL\\\\Schema\\\\Initializer\\:\\:init\\(\\) has no return type specified\\.$#"
count: 1
Expand Down
4 changes: 0 additions & 4 deletions src/bundle/Resources/config/services/resolvers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ services:
Ibexa\GraphQL\Resolver\DomainContentResolver:
tags:
- { name: overblog_graphql.resolver, alias: "DomainContentItemsByTypeIdentifier", method: "resolveDomainContentItems" }
- { name: overblog_graphql.resolver, alias: "DomainFieldValue", method: "resolveDomainFieldValue" }
- { name: overblog_graphql.resolver, alias: "DomainContentType", method: "resolveDomainContentType" }
- { name: overblog_graphql.resolver, alias: "DomainContentItem", method: "resolveDomainContentItem" }
- { name: overblog_graphql.resolver, alias: "DomainRelationFieldValue", method: "resolveDomainRelationFieldValue" }
Expand Down Expand Up @@ -118,9 +117,6 @@ services:
tags:
- { name: overblog_graphql.resolver, alias: "SearchContent", method: "searchContent" }
- { name: overblog_graphql.resolver, alias: "SearchContentOfTypeAsConnection", method: "searchContentOfTypeAsConnection" }
- { name: overblog_graphql.resolver, alias: "SearchLocationsOfTypeAsConnection", method: "searchLocationsOfTypeAsConnection" }
arguments:
$searchService: '@ibexa.siteaccessaware.service.search'

Ibexa\GraphQL\Resolver\RichTextResolver:
arguments:
Expand Down
4 changes: 0 additions & 4 deletions src/bundle/Resources/config/services/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ services:
arguments:
$innerMapper: '@Ibexa\GraphQL\Schema\Domain\Content\Mapper\FieldDefinition\SelectionFieldDefinitionMapper.inner'

Ibexa\GraphQL\Schema\Domain\Content\Worker\FieldDefinition\AddFieldValueToDomainContent: ~

Ibexa\GraphQL\Schema\Domain\Content\Worker\ContentType\AddItemOfTypeConnectionToGroup: ~

Ibexa\GraphQL\Schema\Domain\Content\Worker\ContentType\AddItemToGroup: ~
Expand Down Expand Up @@ -100,8 +98,6 @@ services:

Ibexa\GraphQL\Schema\Generator: ~

Ibexa\GraphQL\Schema\ImagesVariationsBuilder: ~

Ibexa\GraphQL\Schema\SchemaGenerator: ~

Ibexa\GraphQL\Schema\Domain\Pluralizer: ~
Expand Down
8 changes: 0 additions & 8 deletions src/lib/Resolver/DomainContentResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,6 @@ public function resolveMainUrlAlias(Content $content)
return isset($aliases[0]->path) ? $aliases[0]->path : null;
}

/**
* @deprecated since v3.0, use ItemResolver::resolveItemFieldValue() instead.
*/
public function resolveDomainFieldValue(Content $content, $fieldDefinitionIdentifier, $args = null)
ViniTou marked this conversation as resolved.
Show resolved Hide resolved
{
return Field::fromField($content->getField($fieldDefinitionIdentifier, $args['language'] ?? null));
}

public function resolveDomainRelationFieldValue(?Field $field, $multiple = false)
{
if ($field === null) {
Expand Down
9 changes: 1 addition & 8 deletions src/lib/Resolver/SearchResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace Ibexa\GraphQL\Resolver;

use Ibexa\Contracts\Core\Repository\SearchService;
use Ibexa\GraphQL\DataLoader\ContentLoader;
use Ibexa\GraphQL\InputMapper\SearchQueryMapper;
use Overblog\GraphQLBundle\Relay\Connection\Paginator;
Expand All @@ -17,11 +16,6 @@
*/
class SearchResolver
{
/**
* @var \Ibexa\Contracts\Core\Repository\SearchService
*/
private $searchService;

/**
* @var \Ibexa\GraphQL\InputMapper\SearchQueryMapper
*/
Expand All @@ -32,10 +26,9 @@ class SearchResolver
*/
private $contentLoader;

public function __construct(ContentLoader $contentLoader, SearchService $searchService, SearchQueryMapper $queryMapper)
public function __construct(ContentLoader $contentLoader, SearchQueryMapper $queryMapper)
{
$this->contentLoader = $contentLoader;
$this->searchService = $searchService;
$this->queryMapper = $queryMapper;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition;
use Ibexa\Contracts\GraphQL\Schema\Domain\Content\Mapper\FieldDefinition\FieldDefinitionMapper;

class ConfigurableFieldDefinitionMapper implements FieldDefinitionMapper, FieldDefinitionInputMapper, FieldDefinitionArgsBuilderMapper
class ConfigurableFieldDefinitionMapper implements FieldDefinitionMapper
{
/**
* @var array
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading