diff --git a/doc/howto/custom_field_type.md b/doc/howto/custom_field_type.md index 2c379246..3b6386b0 100644 --- a/doc/howto/custom_field_type.md +++ b/doc/howto/custom_field_type.md @@ -19,7 +19,7 @@ Which one you choose depends if the field definition settings and constraints im ### Mapping with configuration You need to use a simple compiler pass to modify a container parameter, `ibexa.graphql.schema.content.mapping.field_definition_type`. -It is a hash that maps a field type identifier (`ezstring`) to the following entries: +It is a hash that maps a field type identifier (`ibexa_string`) to the following entries: - `value_type`: the GraphQL type values of this field are represented as. It can either be a native type (`String`, `Int`...), or a custom type that you will define. If not specified, `String` will be used. @@ -161,7 +161,7 @@ class RelationFieldDefinitionMapper extends DecoratingFieldDefinitionMapper impl ``` #### Mutation input type handling -If the input for a field depends on the field definition, like `ezmatrix` +If the input for a field depends on the field definition, like `ibexa_matrix` which generates its own input types depending on the configured columns, use `mapToFieldValueInputType` which returns a GraphQL type for a Field Definition. diff --git a/spec/Schema/Domain/Content/Mapper/FieldDefinition/RelationFieldDefinitionMapperSpec.php b/spec/Schema/Domain/Content/Mapper/FieldDefinition/RelationFieldDefinitionMapperSpec.php index c5899429..ccd3e1b0 100644 --- a/spec/Schema/Domain/Content/Mapper/FieldDefinition/RelationFieldDefinitionMapperSpec.php +++ b/spec/Schema/Domain/Content/Mapper/FieldDefinition/RelationFieldDefinitionMapperSpec.php @@ -98,7 +98,7 @@ public function it_maps_single_selection_to_resolve_single(): void private function createFieldDefinition(int $selectionLimit = 0, array $selectionContentTypes = []): FieldDefinition { return new FieldDefinition([ - 'fieldTypeIdentifier' => 'ezobjectrelationlist', + 'fieldTypeIdentifier' => 'ibexa_object_relation_list', 'fieldSettings' => [ 'selectionContentTypes' => $selectionContentTypes, ], diff --git a/spec/Schema/Domain/Content/Mapper/FieldDefinition/SelectionFieldDefinitionMapperSpec.php b/spec/Schema/Domain/Content/Mapper/FieldDefinition/SelectionFieldDefinitionMapperSpec.php index 25110394..9a7dba2b 100644 --- a/spec/Schema/Domain/Content/Mapper/FieldDefinition/SelectionFieldDefinitionMapperSpec.php +++ b/spec/Schema/Domain/Content/Mapper/FieldDefinition/SelectionFieldDefinitionMapperSpec.php @@ -15,7 +15,7 @@ class SelectionFieldDefinitionMapperSpec extends ObjectBehavior { public const FIELD_IDENTIFIER = 'test'; - public const TYPE_IDENTIFIER = 'ezselection'; + public const TYPE_IDENTIFIER = 'ibexa_selection'; public function let(FieldDefinitionMapper $innerMapper): void { diff --git a/spec/Schema/Domain/Content/Worker/FieldDefinition/AddFieldDefinitionToItemTypeSpec.php b/spec/Schema/Domain/Content/Worker/FieldDefinition/AddFieldDefinitionToItemTypeSpec.php index e7f3dc51..d203b647 100644 --- a/spec/Schema/Domain/Content/Worker/FieldDefinition/AddFieldDefinitionToItemTypeSpec.php +++ b/spec/Schema/Domain/Content/Worker/FieldDefinition/AddFieldDefinitionToItemTypeSpec.php @@ -24,7 +24,7 @@ class AddFieldDefinitionToItemTypeSpec extends ObjectBehavior public const FIELD_IDENTIFIER = 'test_field'; public const FIELD_NAME = 'testField'; public const FIELD_DESCRIPTION = ['eng-GB' => 'Description']; - public const FIELD_TYPE = 'ezstring'; + public const FIELD_TYPE = 'ibexa_string'; public const FIELD_DEFINITION_TYPE = 'TestFieldDefinition'; /** diff --git a/src/bundle/Resources/config/default_settings.yaml b/src/bundle/Resources/config/default_settings.yaml index 5f1c11cf..4176187a 100644 --- a/src/bundle/Resources/config/default_settings.yaml +++ b/src/bundle/Resources/config/default_settings.yaml @@ -2,84 +2,84 @@ parameters: ibexa.graphql.schema.content.field_name.override: id: id_ ibexa.graphql.schema.content.mapping.field_definition_type: - ezauthor: + ibexa_author: value_type: "[AuthorFieldValue]" value_resolver: 'field !== null ? field.authors : null' input_type: '[AuthorInput]' - ezbinaryfile: + ibexa_binaryfile: definition_type: BinaryFieldDefinition value_type: BinaryFileFieldValue input_type: BinaryFieldInput - ezboolean: + ibexa_boolean: definition_type: CheckboxFieldDefinition value_type: Boolean value_resolver: 'field !== null ? field.bool : null' input_type: Boolean - ezcountry: + ibexa_country: definition_type: CountryFieldDefinition value_type: String input_type: '[String]' - ezdate: + ibexa_date: value_type: DateTime value_resolver: 'field !== null ? field.date : null' input_type: DateFieldInput - ezdatetime: + ibexa_datetime: value_type: DateTime value_resolver: 'field !== null ? field.value : null' input_type: DateFieldInput - ezemail: + ibexa_email: value_type: String - ezuser: + ibexa_user: value_type: String value_resolver: 'field.id' - ezfloat: + ibexa_float: definition_type: FloatFieldDefinition value_type: Float value_resolver: 'field !== null ? field.value : null' input_type: Float - ezgmaplocation: + ibexa_gmap_location: value_type: MapLocationFieldValue input_type: 'MapLocationFieldInput' - ezimage: + ibexa_image: definition_type: BinaryFieldDefinition value_type: ImageFieldValue input_type: ImageFieldInput - ezimageasset: + ibexa_imageasset: value_type: ImageFieldValue value_resolver: 'query("DomainImageAssetFieldValue", field)' - ezinteger: + ibexa_integer: definition_type: IntegerFieldDefinition value_type: Int value_resolver: 'field !== null ? field.value : null' input_type: Int - ezkeyword: + ibexa_keyword: value_type: '[String]' value_resolver: 'field !== null ? field.values : null' input_type: '[String]' - ezmedia: + ibexa_media: definition_type: MediaFieldDefinition value_type: MediaFieldValue input_type: MediaFieldInput - ezobjectrelation: + ibexa_object_relation: definition_type: RelationFieldDefinition value_type: RelationFieldValue input_type: Int - ezobjectrelationlist: + ibexa_object_relation_list: definition_type: RelationListFieldDefinition value_type: RelationListFieldValue input_type: '[Int]' - ezrichtext: + ibexa_richtext: value_type: RichTextFieldValue input_type: RichTextFieldInput - ezselection: + ibexa_selection: definition_type: SelectionFieldDefinition input_type: '[Int]' - ezstring: + ibexa_string: definition_type: TextLineFieldDefinition value_type: String - eztext: + ibexa_text: definition_type: TextBlockFieldDefinition value_type: String - ezurl: + ibexa_url: value_type: UrlFieldValue input_type: UrlFieldInput diff --git a/src/bundle/Resources/config/graphql/FieldDefinition.types.yaml b/src/bundle/Resources/config/graphql/FieldDefinition.types.yaml index 5af2dd2e..4861b8c1 100644 --- a/src/bundle/Resources/config/graphql/FieldDefinition.types.yaml +++ b/src/bundle/Resources/config/graphql/FieldDefinition.types.yaml @@ -33,7 +33,7 @@ FieldDefinition: description: "The position of the field definition in the content type" fieldTypeIdentifier: type: String - description: "The identifier of the field type (ezstring, ezinteger...)." + description: "The identifier of the field type (ibexa_string, ibexa_integer...)." isThumbnail: type: Boolean description: "Indicates if this field can be a thumbnail." diff --git a/src/bundle/Resources/config/services/mutations.yaml b/src/bundle/Resources/config/services/mutations.yaml index 99bbe796..dbb83595 100644 --- a/src/bundle/Resources/config/services/mutations.yaml +++ b/src/bundle/Resources/config/services/mutations.yaml @@ -15,100 +15,100 @@ services: arguments: $fieldType: '@Ibexa\Core\FieldType\Author\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezauthor' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_author' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\BinaryFile: tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezbinaryfile' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_binaryfile' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\Boolean: class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash' arguments: $fieldType: '@Ibexa\Core\FieldType\Checkbox\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezboolean' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_boolean' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\Country: class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash' arguments: $fieldType: '@Ibexa\Core\FieldType\Country\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezcountry' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_country' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\Date: arguments: $fieldType: '@Ibexa\Core\FieldType\Date\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezdate' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_date' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\DateAndTime: class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\Date' arguments: $fieldType: '@Ibexa\Core\FieldType\DateAndTime\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezdatetime' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_datetime' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\Float: class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash' arguments: $fieldType: '@Ibexa\Core\FieldType\Float\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezfloat' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_float' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\Email: class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash' arguments: $fieldType: '@Ibexa\Core\FieldType\EmailAddress\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezemail' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_email' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\Image: tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezimage' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_image' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\Integer: class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash' arguments: $fieldType: '@Ibexa\Core\FieldType\Integer\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezinteger' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_integer' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\ISBN: class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash' arguments: $fieldType: '@Ibexa\Core\FieldType\ISBN\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezisbn' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_isbn' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\Keyword: class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash' arguments: $fieldType: '@Ibexa\Core\FieldType\Keyword\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezkeyword' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_keyword' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\MapLocation: class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash' arguments: $fieldType: '@Ibexa\Core\FieldType\MapLocation\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezgmaplocation' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_gmap_location' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\Media: tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezmedia' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_media' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\Relation: arguments: $fieldType: '@Ibexa\Core\FieldType\Relation\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezobjectrelation' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_object_relation' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\RelationList: arguments: $fieldType: '@Ibexa\Core\FieldType\RelationList\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezobjectrelationlist' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_object_relation_list' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\RichText: arguments: @@ -116,7 +116,7 @@ services: html: '@Ibexa\GraphQL\Mutation\InputHandler\FieldType\RichText\HtmlRichTextConverter' markdown: '@Ibexa\GraphQL\Mutation\InputHandler\FieldType\RichText\MarkdownRichTextConverter' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezrichtext' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_richtext' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\RichText\HtmlRichTextConverter: arguments: @@ -135,25 +135,25 @@ services: arguments: $fieldType: '@Ibexa\Core\FieldType\Selection\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezselection' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_selection' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\TextBlock: class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash' arguments: $fieldType: '@Ibexa\Core\FieldType\TextBlock\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'eztext' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_text' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\TextLine: class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash' arguments: $fieldType: '@Ibexa\Core\FieldType\TextLine\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezstring' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_string' } Ibexa\GraphQL\Mutation\InputHandler\FieldType\Url: class: 'Ibexa\GraphQL\Mutation\InputHandler\FieldType\FromHash' arguments: $fieldType: '@Ibexa\Core\FieldType\Url\Type' tags: - - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ezurl' } + - { name: ibexa.graphql.field_type.input.handler, fieldtype: 'ibexa_url' } diff --git a/src/bundle/Resources/config/services/resolvers.yaml b/src/bundle/Resources/config/services/resolvers.yaml index 0e791e90..884c23b1 100644 --- a/src/bundle/Resources/config/services/resolvers.yaml +++ b/src/bundle/Resources/config/services/resolvers.yaml @@ -129,7 +129,7 @@ services: Ibexa\GraphQL\Resolver\ImageFieldResolver: arguments: $imageFieldType: '@Ibexa\Core\FieldType\Image\Type' - $variationHandler: '@ibexa.field_type.ezimage.variation_service' + $variationHandler: '@ibexa.field_type.ibexa_image.variation_service' $contentService: '@ibexa.siteaccessaware.service.content' tags: - { name: overblog_graphql.query, alias: "ImageVariations", method: "resolveImageVariations" } diff --git a/src/lib/Mutation/InputHandler/FieldType/Date.php b/src/lib/Mutation/InputHandler/FieldType/Date.php index 5582f07f..7bb7836c 100644 --- a/src/lib/Mutation/InputHandler/FieldType/Date.php +++ b/src/lib/Mutation/InputHandler/FieldType/Date.php @@ -23,7 +23,7 @@ public function toFieldValue($input, $inputFormat = null): Value } if (!in_array($inputFormat, ['timestring', 'rfc850', 'timestamp'])) { - throw new UnsupportedFieldInputFormatException('ezdate', $inputFormat); + throw new UnsupportedFieldInputFormatException('ibexa_date', $inputFormat); } return parent::toFieldValue( diff --git a/src/lib/Mutation/InputHandler/FieldType/RichText.php b/src/lib/Mutation/InputHandler/FieldType/RichText.php index 27344d69..60e655e4 100644 --- a/src/lib/Mutation/InputHandler/FieldType/RichText.php +++ b/src/lib/Mutation/InputHandler/FieldType/RichText.php @@ -37,7 +37,7 @@ public function toFieldValue($input, $inputFormat = null): Value $this->inputConverters[$inputFormat]->convertToXml($input) ); } else { - throw new UnsupportedFieldInputFormatException('ezrichtext', $inputFormat); + throw new UnsupportedFieldInputFormatException('ibexa_richtext', $inputFormat); } return $fieldValue; diff --git a/src/lib/Mutation/UploadFiles.php b/src/lib/Mutation/UploadFiles.php index 6a558255..2324dc5d 100644 --- a/src/lib/Mutation/UploadFiles.php +++ b/src/lib/Mutation/UploadFiles.php @@ -86,13 +86,13 @@ private function createContent(array $mapping, UploadedFile $file, int $location $fieldDefinition = $contentType->getFieldDefinition($mapping['contentFieldIdentifier']); switch ($fieldDefinition->fieldTypeIdentifier) { - case 'ezimage': + case 'ibexa_image': $valueType = FieldType\Image\Value::class; break; - case 'ezbinaryfile': + case 'ibexa_binaryfile': $valueType = FieldType\BinaryFile\Value::class; break; - case 'ezmedia': + case 'ibexa_media': $valueType = FieldType\Media\Value::class; break; default: diff --git a/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/RelationFieldDefinitionMapper.php b/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/RelationFieldDefinitionMapper.php index a151f95a..0af9b413 100644 --- a/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/RelationFieldDefinitionMapper.php +++ b/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/RelationFieldDefinitionMapper.php @@ -68,7 +68,7 @@ public function mapToFieldValueResolver(FieldDefinition $fieldDefinition): ?stri protected function canMap(FieldDefinition $fieldDefinition): bool { - return in_array($fieldDefinition->fieldTypeIdentifier, ['ezobjectrelation', 'ezobjectrelationlist']); + return in_array($fieldDefinition->fieldTypeIdentifier, ['ibexa_object_relation', 'ibexa_object_relation_list']); } /** diff --git a/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/SelectionFieldDefinitionMapper.php b/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/SelectionFieldDefinitionMapper.php index b2e496c3..155c9584 100644 --- a/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/SelectionFieldDefinitionMapper.php +++ b/src/lib/Schema/Domain/Content/Mapper/FieldDefinition/SelectionFieldDefinitionMapper.php @@ -32,6 +32,6 @@ public function mapToFieldValueResolver(FieldDefinition $fieldDefinition): ?stri protected function getFieldTypeIdentifier(): string { - return 'ezselection'; + return 'ibexa_selection'; } }