diff --git a/src/bundle/Resources/config/default_settings.yaml b/src/bundle/Resources/config/default_settings.yaml index 7c1e87d..65aef8c 100644 --- a/src/bundle/Resources/config/default_settings.yaml +++ b/src/bundle/Resources/config/default_settings.yaml @@ -4,7 +4,7 @@ parameters: ibexa.graphql.schema.content.mapping.field_definition_type: ezauthor: value_type: "[AuthorFieldValue]" - value_resolver: 'field.authors' + value_resolver: 'field !== null ? field.authors : null' input_type: '[AuthorInput]' ezbinaryfile: definition_type: BinaryFieldDefinition @@ -13,7 +13,7 @@ parameters: ezboolean: definition_type: CheckboxFieldDefinition value_type: Boolean - value_resolver: 'field.bool' + value_resolver: 'field !== null ? field.bool : null' input_type: Boolean ezcountry: definition_type: CountryFieldDefinition @@ -21,11 +21,11 @@ parameters: input_type: '[String]' ezdate: value_type: DateTime - value_resolver: 'field.date' + value_resolver: 'field !== null ? field.date : null' input_type: DateFieldInput ezdatetime: value_type: DateTime - value_resolver: 'field.value' + value_resolver: 'field !== null ? field.value : null' input_type: DateFieldInput ezemail: value_type: String @@ -35,7 +35,7 @@ parameters: ezfloat: definition_type: FloatFieldDefinition value_type: Float - value_resolver: 'field.value' + value_resolver: 'field !== null ? field.value : null' input_type: Float ezgmaplocation: value_type: MapLocationFieldValue @@ -50,11 +50,11 @@ parameters: ezinteger: definition_type: IntegerFieldDefinition value_type: Int - value_resolver: 'field.value' + value_resolver: 'field !== null ? field.value : null' input_type: Int ezkeyword: value_type: '[String]' - value_resolver: 'field.values' + value_resolver: 'field !== null ? field.values : null' input_type: '[String]' ezmedia: definition_type: MediaFieldDefinition diff --git a/src/lib/Resolver/DomainContentResolver.php b/src/lib/Resolver/DomainContentResolver.php index c50b0b8..373f4cd 100644 --- a/src/lib/Resolver/DomainContentResolver.php +++ b/src/lib/Resolver/DomainContentResolver.php @@ -139,8 +139,12 @@ public function resolveDomainFieldValue(Content $content, $fieldDefinitionIdenti return Field::fromField($content->getField($fieldDefinitionIdentifier, $args['language'] ?? null)); } - public function resolveDomainRelationFieldValue(Field $field, $multiple = false) + public function resolveDomainRelationFieldValue(?Field $field, $multiple = false) { + if ($field === null) { + return null; + } + $destinationContentIds = $this->getContentIds($field); if (empty($destinationContentIds) || array_key_exists(0, $destinationContentIds) && null === $destinationContentIds[0]) { diff --git a/src/lib/Resolver/ImageAssetFieldResolver.php b/src/lib/Resolver/ImageAssetFieldResolver.php index 6d88dd3..4fed64e 100644 --- a/src/lib/Resolver/ImageAssetFieldResolver.php +++ b/src/lib/Resolver/ImageAssetFieldResolver.php @@ -29,8 +29,12 @@ public function __construct(iterable $strategies) } } - public function resolveDomainImageAssetFieldValue(Field $field): ?Field + public function resolveDomainImageAssetFieldValue(?Field $field): ?Field { + if ($field === null) { + return null; + } + $destinationContentId = $field->value->destinationContentId; if ($destinationContentId === null) { diff --git a/src/lib/Resolver/SelectionFieldResolver.php b/src/lib/Resolver/SelectionFieldResolver.php index 4925bbe..ac861a7 100644 --- a/src/lib/Resolver/SelectionFieldResolver.php +++ b/src/lib/Resolver/SelectionFieldResolver.php @@ -27,8 +27,12 @@ public function __construct( $this->contentTypeLoader = $contentTypeLoader; } - public function resolveSelectionFieldValue(Field $field, Content $content) + public function resolveSelectionFieldValue(?Field $field, Content $content) { + if ($field === null) { + return null; + } + $fieldDefinition = $this ->contentTypeLoader->load($content->contentInfo->contentTypeId) ->getFieldDefinition($field->fieldDefIdentifier);