diff --git a/doc/02_Basic_Principle.md b/doc/02_Basic_Principle.md index 5fda502f..5731a3c2 100644 --- a/doc/02_Basic_Principle.md +++ b/doc/02_Basic_Principle.md @@ -6,11 +6,15 @@ Pimcore Datahub allows defining multiple endpoints that allow data delivery and 1. Open the Datahub configuration panel: +
+ ![Configuration Overview](./img/graphql/configuration3.png) 2. Choose an endpoint technology: + + ![Add Configuration](./img/add_config.png) 3. Get the configuration done by defining the followings: diff --git a/doc/10_GraphQL/01_Configuration/01_General_Settings.md b/doc/10_GraphQL/01_Configuration/01_General_Settings.md index 7c713e9d..9f659a7d 100644 --- a/doc/10_GraphQL/01_Configuration/01_General_Settings.md +++ b/doc/10_GraphQL/01_Configuration/01_General_Settings.md @@ -1,5 +1,7 @@ # General Settings + + ![General Settings](../../img/graphql/general.png) #### Some Aspects: @@ -8,9 +10,15 @@ the [workspace settings](./03_Security_Settings.md). SQL Condition is currently deprecated but still enabled by default. If you want to disable it, you can do so in the symfony configuration tree: -``` + +```yaml pimcore_data_hub: graphql: allow_sqlObjectCondition: false ``` -Please note that this option will be also removed in the next major version. \ No newline at end of file + +:::caution + +Please note that this option will be also removed in the next major version. + +::: \ No newline at end of file diff --git a/doc/10_GraphQL/01_Configuration/02_Schema_Settings.md b/doc/10_GraphQL/01_Configuration/02_Schema_Settings.md index e261438d..1a0a247b 100644 --- a/doc/10_GraphQL/01_Configuration/02_Schema_Settings.md +++ b/doc/10_GraphQL/01_Configuration/02_Schema_Settings.md @@ -2,6 +2,8 @@ Schema settings define which data entities (Data Object classes, Assets, Documents) should be exposed via the endpoint. For Assets and Documents, default schemas are provided, for Data Object classes the schema can be defined in the field configuration. + + ![Add](../../img/graphql/schema_add.png) ## Query Schema @@ -14,9 +16,16 @@ When adding a new entity with the `Add` button, you can access the `Available Fi In addition, you can employ a set of operators. + + ![Schema Settings](../../img/graphql/schema.png) +:::info + Please note that not all data types are supported yet! + +::: + You will get a notice if you try to add an unsupported data type. ## Mutation Schema diff --git a/doc/10_GraphQL/01_Configuration/03_Security_Settings.md b/doc/10_GraphQL/01_Configuration/03_Security_Settings.md index 2d3965da..7fd824dd 100644 --- a/doc/10_GraphQL/01_Configuration/03_Security_Settings.md +++ b/doc/10_GraphQL/01_Configuration/03_Security_Settings.md @@ -1,5 +1,11 @@ # Security Settings +The security settings define how the endpoint is secured and which data is accessible. + + + +![security1.png](../../img/graphql/security1.png) + ## Authentication Here you can define how users are authenticated when accessing the endpoint. @@ -7,11 +13,19 @@ Here you can define how users are authenticated when accessing the endpoint. #### Supported Methods * API Key: needs to be sent with every request. -* ... more to come + +#### API Key + +To automatically create an API key use the button next to the input. +For each click on the button a new API key is generated and will be added to the input field in addition to the list of existing keys. ## Introspection Settings -Introspection provides an information about queries which are supported by GraphQl schema. This is currently enabled by default. It can be disabled via security settings or in the symfony configuration tree: +Introspection provides an information about queries which are supported by GraphQl schema. +If introspection is enabled, the endpoint will provide a schema definition which can be used by GraphiQL or other tools to provide auto-completion and documentation. +If introspection is disabled, the schema definition will not be provided and therefore no auto-completion or documentation will be available. + +This is currently enabled by default. It can be disabled via security settings tab directly in the backend or in the symfony configuration tree: ``` pimcore_data_hub: graphql: @@ -20,17 +34,21 @@ pimcore_data_hub: ## Workspace Settings -Defines workspaces for data that should be accessible via the endpoint. +Defines workspaces for data that should be accessible via the endpoint. The definition is similar to Pimcore user [workspace permissions](https://pimcore.com/docs/6.x/Development_Documentation/Administration_of_Pimcore/Users_and_Roles.html) +:::warning + +If no workspace is selected, no directories are accessible. + +::: + Available permissions: * Create * Read * Update * Delete -![Settings](../../img/graphql/security1.png) - ## Error Handling - Configuration Values diff --git a/doc/10_GraphQL/04_Query/05_DataObject_Queries.md b/doc/10_GraphQL/04_Query/05_DataObject_Queries.md index 10655b6b..0ea77dd8 100644 --- a/doc/10_GraphQL/04_Query/05_DataObject_Queries.md +++ b/doc/10_GraphQL/04_Query/05_DataObject_Queries.md @@ -1,6 +1,6 @@ # DataObject Queries -## Supported Data Types +## Suppored Data Types Also check out the Pimcore's [data type documentation](https://pimcore.com/docs/6.x/Development_Documentation/Objects/Object_Classes/Data_Types/index.html). @@ -53,18 +53,7 @@ Also check out the Pimcore's [data type documentation](https://pimcore.com/docs/ ## Available Query Operators -Check out the [Operators](./06_Operators.md) page for more information. - -* Alias -* Asset Thumbnail -* Asset Thumbnail HTML -* Concatenator -* Date Formatter -* Element Counter -* Merge -* Substring -* Static Text -* Trimmer +Check out the [operators section](../08_Operators/README.md) for more information. ## Get single Data Object diff --git a/doc/10_GraphQL/04_Query/06_Operators.md b/doc/10_GraphQL/04_Query/06_Operators.md deleted file mode 100644 index 9f940a5b..00000000 --- a/doc/10_GraphQL/04_Query/06_Operators.md +++ /dev/null @@ -1,103 +0,0 @@ -# Query Operators - -Operators allow to modify and transform the data before it is delivered to the endpoint. - -![Overview](../../img/graphql/queryoperators_overview.png) - -#### Alias - -Simply gives the child node a different name. -See also [Using Aliases](./11_Using_Aliases.md) for more information on how to use aliases. - -#### Date Formatter - -Utilizes the PHP date formatter. - -![Datahub Configs](../../img/graphql/date_formatter.png) - -#### Asset Thumbnail - -Returns the thumbnail URL of the assigned image. - -![Thumbnail Config](../../img/graphql/operator_thumbnail.png) - -#### Asset Thumbnail HTML - -Returns the thumbnail HTML tag of the assigned image. - -![Thumbnail Config](../../img/graphql/operator_thumbnail.png) - -#### Concatenator - -Concatenates the child values. - -![Concatenator Config](../../img/graphql/operator_concatenator.png) - -Request: -``` -{ - getPerson(id: 28) { - concatenatedname - } -} -``` - -``` -{ - "data": { - "getPerson": { - "concatenatedname": "John Doe" - } - } -} -``` - - -#### Element Counter - -Counts the child elements. - -![Datahub Configs](../../img/graphql/operator_elementcounter1.png) - -Request: -``` -{ - getUser(id: 50, defaultLanguage: "de") { - count_myobjects - } -} - -``` - -Response: -``` -{ - "data": { - "getUser": { - "count_myobjects": 2 - } - } -} -``` - - -#### Merge - -... - -#### Substring - -As the name says. - -#### Static Text - -Adds some static text. - -#### Translate Value - -Similar to Pimcore's [Translate Value](https://pimcore.com/docs/6.x/User_Documentation/DataObjects/Grid_Configuration_Operators/Operators/TranslateValue.html). -For an example see [Website Translations](./11_Query_Samples/27_Sample_Translate_Values.md) - -#### Trimmer - -As the name says. diff --git a/doc/10_GraphQL/04_Query/08_Localization.md b/doc/10_GraphQL/04_Query/08_Localization.md index b74db6ac..4b399979 100644 --- a/doc/10_GraphQL/04_Query/08_Localization.md +++ b/doc/10_GraphQL/04_Query/08_Localization.md @@ -6,7 +6,7 @@ You can change the default language for localized fields by passing the `default for single and listing queries. ##### Sample Request -``` +```graphql { getNewsListing(defaultLanguage: "de") { ... @@ -18,7 +18,7 @@ for single and listing queries. However, you can always provide an alternative language for a specific field. ##### Sample Request -``` +```graphql { getUser(id: 50, defaultLanguage: "en") { myAdvancedObjects { @@ -39,7 +39,7 @@ However, you can always provide an alternative language for a specific field. ``` ##### Response -``` +```graphql { "data": { "getUser": { diff --git a/doc/10_GraphQL/04_Query/10_Filtering.md b/doc/10_GraphQL/04_Query/10_Filtering.md index 7a4841ed..cc47520c 100644 --- a/doc/10_GraphQL/04_Query/10_Filtering.md +++ b/doc/10_GraphQL/04_Query/10_Filtering.md @@ -6,7 +6,9 @@ to filter listing. ## Sample -Get all `Manufacturer` objects which have 'ca' in their name field. +Get all `Manufacturer` objects which have 'ca' in their name field. + + ![Filtered Grid](../../img/graphql/filtering.png) diff --git a/doc/10_GraphQL/04_Query/11_Query_Samples/05_Sample_Element_Properties.md b/doc/10_GraphQL/04_Query/11_Query_Samples/05_Sample_Element_Properties.md index e9364df6..ba55c3df 100644 --- a/doc/10_GraphQL/04_Query/11_Query_Samples/05_Sample_Element_Properties.md +++ b/doc/10_GraphQL/04_Query/11_Query_Samples/05_Sample_Element_Properties.md @@ -1,5 +1,7 @@ # Get Element Properties + + ![Sample Document Properties](../../../img/graphql/element_properties.png) ### Request diff --git a/doc/10_GraphQL/04_Query/11_Query_Samples/11_Sample_GetAsset.md b/doc/10_GraphQL/04_Query/11_Query_Samples/11_Sample_GetAsset.md index 4924dbab..a1f01fee 100644 --- a/doc/10_GraphQL/04_Query/11_Query_Samples/11_Sample_GetAsset.md +++ b/doc/10_GraphQL/04_Query/11_Query_Samples/11_Sample_GetAsset.md @@ -1,15 +1,24 @@ # Get Asset By Id If you want to access an Asset directly. + +:::caution + Note that the data will be base64 encoded and quite time-consuming to deliver. +::: + Deeplink: [http://pimcore-demo-basic.pim.zone/admin/login/deeplink?asset_4_image](http://pimcore-demo-basic.pim.zone/admin/login/deeplink?asset_4_image) ### Request +:::info + Note that for the fullpath and the base64 encoded data you can specify a thumbnail config. You can use the `format` argument to retrieve the values for a specific format like `webp`. +::: + ``` { getAsset(id: 4) { diff --git a/doc/10_GraphQL/04_Query/11_Query_Samples/12_Sample_Asset_Metadata.md b/doc/10_GraphQL/04_Query/11_Query_Samples/12_Sample_Asset_Metadata.md index 9ad8c7af..73735a12 100644 --- a/doc/10_GraphQL/04_Query/11_Query_Samples/12_Sample_Asset_Metadata.md +++ b/doc/10_GraphQL/04_Query/11_Query_Samples/12_Sample_Asset_Metadata.md @@ -1,5 +1,7 @@ # Get Asset Metadata + + ![Metadata](../../../img/graphql/asset_metadata.png) Deeplink: [http://pimcore-demo-basic.pim.zone/admin/login/deeplink?asset_4_image](http://pimcore-demo-basic.pim.zone/admin/login/deeplink?asset_4_image) @@ -82,6 +84,8 @@ Get the custom asset metadata for language `de` ## Get Asset Embedded Meta Info + + ![Metadata](../../../img/graphql/asset_embeddedMetaInfo.png) ### Request diff --git a/doc/10_GraphQL/04_Query/11_Query_Samples/13_Sample_GetAssetListing.md b/doc/10_GraphQL/04_Query/11_Query_Samples/13_Sample_GetAssetListing.md index b0ba3e69..9cea78c4 100644 --- a/doc/10_GraphQL/04_Query/11_Query_Samples/13_Sample_GetAssetListing.md +++ b/doc/10_GraphQL/04_Query/11_Query_Samples/13_Sample_GetAssetListing.md @@ -2,8 +2,12 @@ ### Request +:::info + Note that for the fullpath and the base64 encoded data you can specify a thumbnail config. +::: + ``` { getAssetListing { diff --git a/doc/10_GraphQL/04_Query/11_Query_Samples/20_Sample_Manufacturer_Listing.md b/doc/10_GraphQL/04_Query/11_Query_Samples/20_Sample_Manufacturer_Listing.md index a467fcb6..59a735a8 100644 --- a/doc/10_GraphQL/04_Query/11_Query_Samples/20_Sample_Manufacturer_Listing.md +++ b/doc/10_GraphQL/04_Query/11_Query_Samples/20_Sample_Manufacturer_Listing.md @@ -1,5 +1,7 @@ # Get Manufacturer Listing + + ![Grid](../../../img/graphql/manufacturer_listing.png) ### Request diff --git a/doc/10_GraphQL/04_Query/11_Query_Samples/21_Sample_ManyToMany_Object_Relation.md b/doc/10_GraphQL/04_Query/11_Query_Samples/21_Sample_ManyToMany_Object_Relation.md index 7e5dd33b..ad068f29 100644 --- a/doc/10_GraphQL/04_Query/11_Query_Samples/21_Sample_ManyToMany_Object_Relation.md +++ b/doc/10_GraphQL/04_Query/11_Query_Samples/21_Sample_ManyToMany_Object_Relation.md @@ -1,5 +1,7 @@ # Many-to-Many Object Relation + + ![Data](../../../img/graphql/many_to_many_object_relation.png) ### Request diff --git a/doc/10_GraphQL/04_Query/11_Query_Samples/22_Sample_Advanced_ManyToMany_Object_Relation.md b/doc/10_GraphQL/04_Query/11_Query_Samples/22_Sample_Advanced_ManyToMany_Object_Relation.md index 32a74302..28251736 100644 --- a/doc/10_GraphQL/04_Query/11_Query_Samples/22_Sample_Advanced_ManyToMany_Object_Relation.md +++ b/doc/10_GraphQL/04_Query/11_Query_Samples/22_Sample_Advanced_ManyToMany_Object_Relation.md @@ -1,32 +1,37 @@ # Advanced Many-to-Many Object Relation and Metadata ->TODO: Align this with the new demo as soon as reasonable content is available. +Data Model for class `AccessoryPart`: -Data Model: + ![Data](../../../img/graphql/advanced_many_to_many_object_relation.png) Data: + + ![Data](../../../img/graphql/advanced_many_to_many_object_relation2.png) ### Request +:::info + Note that the response differs from `Advanced Many-to-Many Relations` as there can be only class. +::: + ``` { - getUser(id: 50, defaultLanguage: "en") { - myAdvancedObjects { + getAccessoryPart(id:408) { + id, + classname + advAdditionalCategories { element { - id + id, classname - title, - deTitle: title(language: "de"), - shortText(language: "de") } metadata { - name + name, value } } @@ -36,48 +41,22 @@ Note that the response differs from `Advanced Many-to-Many Relations` as there c ### Response -Here you also see the use of aliases. - ``` { "data": { - "getUser": { - "myAdvancedObjects": [ + "getAccessoryPart": { + "id": "408", + "classname": "AccessoryPart", + "advAdditionalCategories": [ { "element": { - "id": "8", - "classname": "news", - "title": "In enim justo", - "deTitle": "Li Europan lingues es membres", - "shortText": "Lor separat existentie es un myth. Por scientie, musica, sport etc, litot Europa usa li sam vocabular." + "id": "392", + "classname": "Category" }, "metadata": [ { - "name": "altname", - "value": "Ratman" - }, - { - "name": "name", - "value": "Canine" - } - ] - }, - { - "element": { - "id": "3", - "classname": "news", - "title": "Lorem ipsum dolor sit amet", - "deTitle": "Er hörte leise Schritte hinter sich", - "shortText": "Das bedeutete nichts Gutes. Wer würde ihm schon folgen, spät in der Nacht und dazu noch in dieser engen Gasse mitten im übel beleumundeten Hafenviertel?" - }, - "metadata": [ - { - "name": "altname", - "value": "Spike" - }, - { - "name": "name", - "value": "Doctor" + "name": "altName", + "value": "AlternativeNameForCategory" } ] } diff --git a/doc/10_GraphQL/04_Query/11_Query_Samples/23_Sample_Advanced_ManyToMany_Relation_Metadata.md b/doc/10_GraphQL/04_Query/11_Query_Samples/23_Sample_Advanced_ManyToMany_Relation_Metadata.md index c7d03c67..ee8e71d6 100644 --- a/doc/10_GraphQL/04_Query/11_Query_Samples/23_Sample_Advanced_ManyToMany_Relation_Metadata.md +++ b/doc/10_GraphQL/04_Query/11_Query_Samples/23_Sample_Advanced_ManyToMany_Relation_Metadata.md @@ -1,24 +1,46 @@ # Get Advanced Many-to-Many Relation Metadata + + ![Metadata](../../../img/graphql/many2many.png) ->TODO: Align this with the new demo as soon as reasonable content is available. +Data: + + + +![many2many_data.png](../../../img/graphql/many2many_data.png) ### Request -News listing with limit 3 and offset 1 -``` +:::info + +Make sure to use the correct inline fragments to access data from the related classes. +The exact class name is required to access the data. E.g. for manufacturer data use `... on object_Manufacturer`. + +::: + +```graphql { - getUser(id: 50) { - # advanced many-to-many relation - multimeta { + getAccessoryPart(id:408) { + id, + classname + additionalLinkedElements { element { - ... on asset { + ... on asset { + id, + fullpath + } + ... on object_Manufacturer { + id, + name + } + ... on document_page { + id, fullpath } } metadata { - name + name, value } } @@ -28,52 +50,52 @@ News listing with limit 3 and offset 1 ### Response -``` +```json { - "data": { - "getUser": { - "multimeta": [ - { - "element": { - "fullpath": "/screenshots/properties-2.png" - }, - "metadata": [ - { - "name": "aname", - "value": "B" - }, - { - "name": "multi", - "value": "1,2" - }, - { - "name": "name", - "value": "A" - } - ] - }, - { - "element": { - "fullpath": "/screenshots/pim1.png" - }, - "metadata": [ - { - "name": "aname", - "value": "D" - }, - { - "name": "multi", - "value": "3,2" - }, - { - "name": "name", - "value": "C" - } - ] + "data": { + "getAccessoryPart": { + "id": "408", + "classname": "AccessoryPart", + "additionalLinkedElements": [ + { + "element": { + "id": "97", + "fullpath": "/en/Find-and-Buy/On-Sale" + }, + "metadata": [ + { + "name": "altName", + "value": "OnSale" + } + ] + }, + { + "element": { + "id": "33", + "fullpath": "/Car%20Images/austin%20healey/austin-healey-1019023.jpg" + }, + "metadata": [ + { + "name": "altName", + "value": "CarImage" + } + ] + }, + { + "element": { + "id": "35", + "name": "Austin-Healey" + }, + "metadata": [ + { + "name": "altName", + "value": "Manufacturer" + } + ] + } + ] } - ] } - } } ``` diff --git a/doc/10_GraphQL/04_Query/11_Query_Samples/24_Sample_Fieldcollections.md b/doc/10_GraphQL/04_Query/11_Query_Samples/24_Sample_Fieldcollections.md index c906b868..03bf371b 100644 --- a/doc/10_GraphQL/04_Query/11_Query_Samples/24_Sample_Fieldcollections.md +++ b/doc/10_GraphQL/04_Query/11_Query_Samples/24_Sample_Fieldcollections.md @@ -4,12 +4,16 @@ If you want to run this sample on the [Official Demo Site](https://demo.pimcore.fun), please create the following configuration + + ![Schema](../../../img/graphql/news_configuration.png) ### Sample Data Deeplink: https://demo.pimcore.fun/admin/login/deeplink?object_767_object + + ![Sample Data](../../../img/graphql/news_sample_data.png) ### Request @@ -42,6 +46,8 @@ Deeplink: https://demo.pimcore.fun/admin/login/deeplink?object_767_object and make sure that the `/News` folder is readable. + + ![Workspace](../../../img/graphql/news_workspace.png) ### Response diff --git a/doc/10_GraphQL/04_Query/11_Query_Samples/25_Sample_Parent_Children_Siblings.md b/doc/10_GraphQL/04_Query/11_Query_Samples/25_Sample_Parent_Children_Siblings.md index a5313d2b..fb59c799 100644 --- a/doc/10_GraphQL/04_Query/11_Query_Samples/25_Sample_Parent_Children_Siblings.md +++ b/doc/10_GraphQL/04_Query/11_Query_Samples/25_Sample_Parent_Children_Siblings.md @@ -2,11 +2,18 @@ For example, to get `berlina` object's (id:261) parent, children and siblings + + ![](../../../img/graphql/sample_parentChildrenSiblings.png) ### Request +:::info + Note that for `children` and `_siblings` you can use the `objectTypes` argument to filter for specific types. + +::: + Any combination of `variant`, `object`, `folder` is possible as a value for the `objectTypes` argument (default: `["object", "folder"]`). ```graphql diff --git a/doc/10_GraphQL/04_Query/11_Query_Samples/26_Sample_Get_Linked_Data.md b/doc/10_GraphQL/04_Query/11_Query_Samples/26_Sample_Get_Linked_Data.md index 7ab1caec..6f8581bb 100644 --- a/doc/10_GraphQL/04_Query/11_Query_Samples/26_Sample_Get_Linked_Data.md +++ b/doc/10_GraphQL/04_Query/11_Query_Samples/26_Sample_Get_Linked_Data.md @@ -6,8 +6,15 @@ Deeplink: [https://demo.pimcore.fun/admin/login/deeplink?object_277_object](https://demo.pimcore.fun/admin/login/deeplink?object_277_object) -Note that you have to adapt your schema definition as depicted below. The thumbnail -will generated using the [Thumbnail Operator](../06_Operators.md). +:::info + +Note that you have to adapt your schema definition as depicted below. + +::: + +The thumbnail will be generated using the [Thumbnail operator](../../08_Operators/Query/AssetThumbnail.md). + + ![Schema Definition](../../../img/graphql/manufacturer_thumbnail.png) diff --git a/doc/10_GraphQL/04_Query/11_Query_Samples/27_Sample_Translate_Values.md b/doc/10_GraphQL/04_Query/11_Query_Samples/27_Sample_Translate_Values.md index 45cf6cc7..7f2ea80a 100644 --- a/doc/10_GraphQL/04_Query/11_Query_Samples/27_Sample_Translate_Values.md +++ b/doc/10_GraphQL/04_Query/11_Query_Samples/27_Sample_Translate_Values.md @@ -6,10 +6,14 @@ Deeplink: [http://pimcore-demo-basic.pim.zone/admin/login/deeplink?object_373_ob Operator Config: + + ![Operator Config](../../../img/graphql/operator_translated1.png) Website Translation Grid: + + ![Data](../../../img/graphql/operator_translated2.png) The idea in the following example is to use the website translation feature to convert diff --git a/doc/10_GraphQL/04_Query/11_Using_Aliases.md b/doc/10_GraphQL/04_Query/11_Using_Aliases.md index a3939b97..efa89ff5 100644 --- a/doc/10_GraphQL/04_Query/11_Using_Aliases.md +++ b/doc/10_GraphQL/04_Query/11_Using_Aliases.md @@ -7,7 +7,7 @@ There are two ways to use aliases: ## Alias Operator -See [06_Operators.md](06_Operators.md) for more information. +See [Alias operator](../08_Operators/Query/Alias.md) for more information. ## Alias in the Query diff --git a/doc/10_GraphQL/04_Query/15_Add_Custom_Query_Datatype.md b/doc/10_GraphQL/04_Query/15_Add_Custom_Query_Datatype.md index ddfe5fac..59b97315 100644 --- a/doc/10_GraphQL/04_Query/15_Add_Custom_Query_Datatype.md +++ b/doc/10_GraphQL/04_Query/15_Add_Custom_Query_Datatype.md @@ -7,7 +7,7 @@ For adding a new query data type two steps are necessary: To add a type definition, add a section similar to this one to your `services.yml` file. -``` +```yaml pimcore.datahub.graphql.dataobjectquerytypegenerator_datatype_mycustomdatatype: class: Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectQueryFieldConfigGenerator\MyCustomDatatype tags: diff --git a/doc/10_GraphQL/04_Query/16_Add_Custom_Query_Operator.md b/doc/10_GraphQL/04_Query/16_Add_Custom_Query_Operator.md index d041d299..3fd2eff4 100644 --- a/doc/10_GraphQL/04_Query/16_Add_Custom_Query_Operator.md +++ b/doc/10_GraphQL/04_Query/16_Add_Custom_Query_Operator.md @@ -8,7 +8,7 @@ For adding a new query operator two steps are necessary: Add a section similar to this one to your `services.yml` file. -``` +```yaml pimcore.datahub.graphql.querytypegenerator_operator_mycustomoperator: class: Pimcore\Bundle\DataHubBundle\GraphQL\QueryOperatorConfigGenerator\MyCustomOperator tags: @@ -24,7 +24,12 @@ You have to provide both JavaScript code dealing with the UI configuration aspec and the server-side PHP implementation doing the actual calculations. A JS sample can be found [here](https://github.com/pimcore/data-hub/blob/master/src/Resources/public/js/queryoperator/Trimmer.js). -Note that the namespace would be `pimcore.plugin.datahub.operator.mycustomoperator`. + +:::info + +Note that the namespace would be `pimcore.plugin.datahub.operator.mycustomoperator`. + +::: Make sure, that your extension gets loaded. See [Pimcore Bundles](https://pimcore.com/docs/6.x/Development_Documentation/Extending_Pimcore/Bundle_Developers_Guide/Pimcore_Bundles/index.html) docs page for further details. @@ -35,7 +40,7 @@ A sample can be found [here](https://github.com/pimcore/data-hub/blob/master/src Finally, we have to define how the operator instances get created. In most cases we use the `DefaultOperatorFactory` for that: -``` +```yaml pimcore.datahub.graphql.dataobjectqueryoperator.factory.mycustomoperator: class: Pimcore\Bundle\DataHubBundle\GraphQL\Query\Operator\Factory\DefaultOperatorFactory arguments: diff --git a/doc/10_GraphQL/04_Query/20_Add_Custom_Query.md b/doc/10_GraphQL/04_Query/20_Add_Custom_Query.md index 35d9e616..903e1f52 100644 --- a/doc/10_GraphQL/04_Query/20_Add_Custom_Query.md +++ b/doc/10_GraphQL/04_Query/20_Add_Custom_Query.md @@ -43,6 +43,7 @@ if you need more information on Pimcore's event mechanism. $event->setConfig($config); }); ``` + ![iExplorer](../../img/graphql/add_query.png) diff --git a/doc/10_GraphQL/07_Mutation/01_Document_Mutations.md b/doc/10_GraphQL/07_Mutation/01_Document_Mutations.md index 17502b11..ed7af5b3 100644 --- a/doc/10_GraphQL/07_Mutation/01_Document_Mutations.md +++ b/doc/10_GraphQL/07_Mutation/01_Document_Mutations.md @@ -28,7 +28,11 @@ creating and updating documents. ### Free-form API -> Important Note: To be able to fully exploit this feature you have to understand Pimcore's [editable naming strategy](https://pimcore.com/docs/6.x/Development_Documentation/Documents/Editable_Naming_Strategies.html) +:::info + +Important Note: To be able to fully exploit this feature you have to understand Pimcore's [editable naming strategy](https://pimcore.com/docs/6.x/Development_Documentation/Documents/Editable_Naming_Strategies.html) + +::: Update or add single or multiple editables by defining their exact name and their content. diff --git a/doc/10_GraphQL/07_Mutation/20_DataObject_Mutations.md b/doc/10_GraphQL/07_Mutation/20_DataObject_Mutations.md index 432de25e..20713476 100644 --- a/doc/10_GraphQL/07_Mutation/20_DataObject_Mutations.md +++ b/doc/10_GraphQL/07_Mutation/20_DataObject_Mutations.md @@ -1,77 +1,39 @@ # DataObject Mutations ->TODO: Align this with the new demo as soon as reasonable content is available. - -* Create Objects -* Update Objects -* Delete Objects +Data object mutations are used to create, update and delete data objects, documents, assets and translations. +Keep in mind that for all kinds of mutations you need the `Write` permission and the mutation itself needs to be enabled in the configuration. -In addition, you can turn on mutations to modify assets, create object folders and on on. - +:::info + +Please be aware, that not all operations are supported for all data types. + +::: + + ![Mutation grid](../../img/graphql/mutation_grid.png) - + +:::info + Note that for `Create` and `Update` operate you can query the updated data using the same request. -Keep in mind that for all kinds of mutations you need the `Write` permission. -## Supported Mutation Datatypes +::: -![Mutation grid](../../img/graphql/mutation_grid.png) +## Supported Mutation Datatypes -Also check out the Pimcore's [data type documentation](https://pimcore.com/docs/6.x/Development_Documentation/Objects/Object_Classes/Data_Types/index.html). - -* Boolean Select -* Checkbox -* Country -* Countries (Multiselect) -* Date -* DateTime -* Email -* External Image -* Field Collections -* Firstname -* Gender -* Geopoint -* Image -* ImageGallery -* Input -* Input Quantity Value -* Language -* Lastname -* Link -* Many-to-One Relation -* Many-to-Many Relation -* Many-to-Many Object Relation -* Advanced Many-to-Many Relation -* Advanced Many-to-Many Object Relation -* Multiselect -* Newsletter Active -* Newsletter Confirmed -* Numeric -* Quantity Value -* Select -* Slider -* Table -* Textarea -* Time -* Wysiwyg +Also check out the Pimcore's [data type documentation](https://pimcore.com/docs/6.x/Development_Documentation/Objects/Object_Classes/Data_Types/index.html). +For supported mutation datatypes please check the `DataObjectMutationFieldConfigGenerator` folder in `src/GraphQL/`. ## Supported Mutation Operators -* IfEmpty -* Locale Switcher -* ... - -See [the overview page](./21_Mutation_Operators.md) for more details. +See [operators section](../08_Operators/README.md) for more details. ## Create Object -TBD: do we need an extra workspace permission for that ? (in addition to write which would be only used for updates) - Request: -``` +```graphql mutation { - createNews(parentId: 66, key: "testcreate27", published: false) { + createNews(parentId: 429, key: "news_created_by_gql", published: false) { success message output(defaultLanguage: "de") { @@ -85,16 +47,16 @@ mutation { ``` Response: -``` +```json { "data": { "createNews": { "success": true, - "message": "object created: 98", + "message": "object created: 1196", "output": { - "id": "98", - "creationDate": 1559642310, - "fullpath": "/tests/testcreate2/testcreate27", + "id": "1196", + "creationDate": 1732785597, + "fullpath": "/Product Data/Accessories/lights/indicator lights/chevrolet-bel air-tail lights/news_created_by_gql", "title": null } } @@ -107,25 +69,31 @@ Response: Updates german title and short text and returns the modification date. Request: -``` +```graphql mutation { - updateNews(id: 773, defaultLanguage: "de", input: {title: "german TITLE", shortText: "new short text"}) { + updateNews(id: 1196, defaultLanguage: "de", input: { + title: "german TITLE", + shortText: "new short text" + } + ) { success output { - modificationDate + modificationDate, + title } } } ``` Response: -``` +```json { "data": { "updateNews": { "success": true, "output": { - "modificationDate": 1559746654 + "modificationDate": 1732785648, + "title": "german TITLE" } } } @@ -135,9 +103,9 @@ Response: ## Delete Object Request: -``` +```graphql mutation { - deleteBlogCategory(id: 37) { + deleteNews(id: 1196) { success message } @@ -145,10 +113,10 @@ mutation { ``` Response: -``` +```graphql { "data": { - "deleteBlogCategory": { + "deleteNews": { "success": true, "message": "" } @@ -157,8 +125,6 @@ Response: ``` - - ## Extend Data Object Mutations It is possible to add custom mutation data types and mutation operators. For details see detail documentation pages: diff --git a/doc/10_GraphQL/07_Mutation/21_Mutation_Operators.md b/doc/10_GraphQL/07_Mutation/21_Mutation_Operators.md deleted file mode 100644 index 12fcccbb..00000000 --- a/doc/10_GraphQL/07_Mutation/21_Mutation_Operators.md +++ /dev/null @@ -1,17 +0,0 @@ -# Mutation Operators - -Operators allow to modify and transform the data before it is stored in Pimcore. - -![Overview](../../img/graphql/mutation_operators.png) - -#### IfNotEmpty - -Only sets the value if current one is empty. - -#### Locale Switcher - -Switches to different language other than the default language. - -#### Locale Collector - -Allows editing all languages for a single field. diff --git a/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/01_FreeformAPI_Create_Document_with_Areablocks.md b/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/01_FreeformAPI_Create_Document_with_Areablocks.md index 8b7f5289..86f108a1 100644 --- a/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/01_FreeformAPI_Create_Document_with_Areablocks.md +++ b/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/01_FreeformAPI_Create_Document_with_Areablocks.md @@ -62,5 +62,6 @@ mutation { } } ``` + ![Grid](../../../img/graphql/document_create_mutation.png) \ No newline at end of file diff --git a/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/02_FreeformAPI_Update_Email_Document.md b/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/02_FreeformAPI_Update_Email_Document.md index 07b48e96..ea15ec88 100644 --- a/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/02_FreeformAPI_Update_Email_Document.md +++ b/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/02_FreeformAPI_Update_Email_Document.md @@ -27,4 +27,6 @@ mutation { } ``` + + ![Grid](../../../img/graphql/document_updateemail_mutation.png) \ No newline at end of file diff --git a/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/03_FreeformAPI_Create_new_Link_Document.md b/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/03_FreeformAPI_Create_new_Link_Document.md index 03030915..66abd3b1 100644 --- a/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/03_FreeformAPI_Create_new_Link_Document.md +++ b/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/03_FreeformAPI_Create_new_Link_Document.md @@ -12,4 +12,7 @@ mutation { } } ``` + + + ![Grid](../../../img/graphql/document_create_link.png) diff --git a/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/04_TreeAPI_Create_Document_with_Areablocks.md b/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/04_TreeAPI_Create_Document_with_Areablocks.md index ad3991c7..a8418cb1 100644 --- a/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/04_TreeAPI_Create_Document_with_Areablocks.md +++ b/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/04_TreeAPI_Create_Document_with_Areablocks.md @@ -99,4 +99,4 @@ mutation { } } } -``` \ No newline at end of file +``` \ No newline at end of file diff --git a/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/10_Sample_Add_Relations.md b/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/10_Sample_Add_Relations.md index 87fd20a2..6e3d0e11 100644 --- a/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/10_Sample_Add_Relations.md +++ b/doc/10_GraphQL/07_Mutation/24_Mutation_Samples/10_Sample_Add_Relations.md @@ -2,7 +2,9 @@ This will add relations to categories relation field of Car object. Type can be omitted for mutations only allowing one type, e.g. many-to-many-objects . -> Note: Read permissions are required for related objects to be assigned. +:::info +Note: Read permissions are required for related objects to be assigned. +::: Request: ``` diff --git a/doc/10_GraphQL/07_Mutation/25_Add_Custom_Mutation_Datatype.md b/doc/10_GraphQL/07_Mutation/25_Add_Custom_Mutation_Datatype.md index f1f0bbdf..bab92b1f 100644 --- a/doc/10_GraphQL/07_Mutation/25_Add_Custom_Mutation_Datatype.md +++ b/doc/10_GraphQL/07_Mutation/25_Add_Custom_Mutation_Datatype.md @@ -6,7 +6,7 @@ For adding a new mutation data type two steps are necessary: Add a section similar to this one to your `services.yml` file. -``` +```yaml pimcore.datahub.graphql.dataobjectmutationtypegenerator_datatype_mycustomdatatype: class: Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectMutationFieldConfigGenerator\MyCustomDatatype tags: diff --git a/doc/10_GraphQL/07_Mutation/26_Add_Custom_Mutation_Operator.md b/doc/10_GraphQL/07_Mutation/26_Add_Custom_Mutation_Operator.md index f7b4b898..009b6d92 100644 --- a/doc/10_GraphQL/07_Mutation/26_Add_Custom_Mutation_Operator.md +++ b/doc/10_GraphQL/07_Mutation/26_Add_Custom_Mutation_Operator.md @@ -7,7 +7,7 @@ For adding a new mutation operator two steps are necessary: ### Type Definition Add a section similar to this one to your `services.yml` file. -``` +```yaml pimcore.datahub.graphql.dataobjectmutationtypegenerator_operator_mycustommutationoperator: class: Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectMutationOperatorConfigGenerator\MyCustomMutationOperator tags: @@ -29,8 +29,12 @@ and the server-side PHP implementation processing the input (the input processor A JS sample can be found [here](https://github.com/pimcore/data-hub/blob/master/src/Resources/public/js/mutationoperator/IfEmpty.js). +:::info + Note that the namespace in your case would be `pimcore.plugin.datahub.mutationoperator.mycustommutationoperator`. +::: + Make sure that your extension gets loaded. See [Pimcore Bundles](https://pimcore.com/docs/6.x/Development_Documentation/Extending_Pimcore/Bundle_Developers_Guide/Pimcore_Bundles/index.html) docs page for further details. diff --git a/doc/10_GraphQL/07_Mutation/27_Add_Custom_Mutations.md b/doc/10_GraphQL/07_Mutation/27_Add_Custom_Mutations.md index c78dd1d8..e06cd5d7 100644 --- a/doc/10_GraphQL/07_Mutation/27_Add_Custom_Mutations.md +++ b/doc/10_GraphQL/07_Mutation/27_Add_Custom_Mutations.md @@ -38,6 +38,7 @@ if you need more information on Pimcore's event mechanism. $event->setConfig($config); }); ``` + ![iExplorer](../../img/graphql/add_mutation.png) diff --git a/doc/10_GraphQL/08_Operators/Mutation/IfEmpty.md b/doc/10_GraphQL/08_Operators/Mutation/IfEmpty.md new file mode 100644 index 00000000..a25d7e59 --- /dev/null +++ b/doc/10_GraphQL/08_Operators/Mutation/IfEmpty.md @@ -0,0 +1,50 @@ +# If Empty + +Only sets the value if current one is empty. Add the operator to the list and drag & drop the desired field into the operator. + +## Configuration + + + +![ifempty_config.png](../../../img/graphql/ifempty_config.png) + +- **Label**: Field name to be used in the query. + +## Example + + + +![ifempty_example.png](../../../img/graphql/ifempty_example.png) + +Request: +```graphql +mutation { + updateCar( + id:82 + input:{ + UpdateDescription:"Description if description is empty" + } + ) { + success, + output { + description + } + } +} +``` + +Response: +```json +{ + "data": { + "updateCar": { + "success": true, + "output": { + "description": "Description if description is empty" + } + } + } +} +``` +[] + diff --git a/doc/10_GraphQL/08_Operators/Mutation/LocalCollector.md b/doc/10_GraphQL/08_Operators/Mutation/LocalCollector.md new file mode 100644 index 00000000..f160da46 --- /dev/null +++ b/doc/10_GraphQL/08_Operators/Mutation/LocalCollector.md @@ -0,0 +1,56 @@ +# Locale Collector + +Allows editing all languages for a single field. + +## Configuration + + + +![locale_collector_config.png](../../../img/graphql/locale_collector_config.png) + +- **Label**: Name for the field to be used in the mutation. + +## Example + + + +![locale_collector_example.png](../../../img/graphql/locale_collector_example.png) + +Request: +```graphql +mutation { + updateCar( + id:82 + input:{ + LocaleEditorName: { + en:"Name_en", + de:"Name_de", + fr:"Name_fr" + } + } + ) { + success, + output { + name_en: name(language:"en"), + name_de: name(language:"de"), + name_fr: name(language:"fr") + } + } +} +``` + +Response: +```json +{ + "data": { + "updateCar": { + "success": true, + "output": { + "name_en": "Name_en", + "name_de": "Name_de", + "name_fr": "Name_fr" + } + } + } +} +``` \ No newline at end of file diff --git a/doc/10_GraphQL/08_Operators/Mutation/LocaleSwitcher.md b/doc/10_GraphQL/08_Operators/Mutation/LocaleSwitcher.md new file mode 100644 index 00000000..f3edfeb5 --- /dev/null +++ b/doc/10_GraphQL/08_Operators/Mutation/LocaleSwitcher.md @@ -0,0 +1,51 @@ +# Locale Switcher + + + +![locale_switcher_config.png](../../../img/graphql/locale_switcher_config.png) + +Switches to different language other than the default language. Add the operator to the list and + +## Configuration + + + +![locale_switcher_example.png](../../../img/graphql/locale_switcher_example.png) + +- **Label**: Field name to be used in the query. +- **Locale**: The locale you want to switch to. + +## Example + +Request: +```graphql +mutation { + updateCar( + id:82 + input:{ + name_ger:"Wert für name Feld" + } + ) { + success, + output { + name_en:name(language:"en") + name_de:name(language:"de") + } + } +} +``` + +Response: +```json +{ + "data": { + "updateCar": { + "success": true, + "output": { + "name_en": "Name_en", + "name_de": "Wert für name Feld" + } + } + } +} +``` \ No newline at end of file diff --git a/doc/10_GraphQL/08_Operators/Query/Alias.md b/doc/10_GraphQL/08_Operators/Query/Alias.md new file mode 100644 index 00000000..c737beb9 --- /dev/null +++ b/doc/10_GraphQL/08_Operators/Query/Alias.md @@ -0,0 +1,46 @@ +# Alias + +Simply gives the child node a different name. + +If you are looking for a way to directly use aliases in a GraphQL query, please see [11_Using_Aliases.md](../../04_Query/11_Using_Aliases.md) . + +## Configuration + + + +![alias_config.png](../../../img/graphql/alias_config.png) + +- **Attribute**: The new name for the field to be used in the query. + +## Example + + + +![alias_example.png](../../../img/graphql/alias_example.png) + +Request: +```graphql +{ + getCar(id: 82) { + id, + key, + AliasForKey + } +} +``` + +Response: +```json +{ + "data": { + "getCar": { + "id": "81", + "key": "Cobra 427", + "AliasForKey": "Cobra 427" + } + } +} +``` + + + diff --git a/doc/10_GraphQL/08_Operators/Query/AssetThumbnail.md b/doc/10_GraphQL/08_Operators/Query/AssetThumbnail.md new file mode 100644 index 00000000..82f3fd1c --- /dev/null +++ b/doc/10_GraphQL/08_Operators/Query/AssetThumbnail.md @@ -0,0 +1,42 @@ +# Asset Thumbnail + +Returns the selected thumbnail URL. + +## Configuration + + + +![Thumbnail Config](../../../img/graphql/thumbnail_config.png) + +- **Attribute**: Name for the field to use in the query. +- **Thumbnail**: Select the desired thumbnail from the list. + +## Example + + + +![thumbnail_example.png](../../../img/graphql/thumbnail_example.png) + +Request: +```graphql +{ + getCar(id: 82) { + id, + contentThumbnail + } +} +``` + +Response: +```json +{ + "data": { + "getCar": { + "id": "82", + "contentThumbnail": "/Car%20Images/ac%20cars/68/image-thumb__68__content/automotive-car-classic-149813.44c4f656.jpg" + } + } +} +``` + +[] \ No newline at end of file diff --git a/doc/10_GraphQL/08_Operators/Query/AssetThumbnailHTML.md b/doc/10_GraphQL/08_Operators/Query/AssetThumbnailHTML.md new file mode 100644 index 00000000..bac408cf --- /dev/null +++ b/doc/10_GraphQL/08_Operators/Query/AssetThumbnailHTML.md @@ -0,0 +1,40 @@ +# Asset Thumbnail HTML + +Returns the selected thumbnail HTML tag. + +## Configuration + + + +![thumbnail_html_config.png](../../../img/graphql/thumbnail_html_config.png) + +- **Attribute**: Name for the field to use in the query. +- **Thumbnail**: Select the desired thumbnail from the list. + +## Example + + + +![thumbnail_html_example.png](../../../img/graphql/thumbnail_html_example.png) + +Request: +```graphql +{ + getCar(id: 82) { + id, + contentThumbnailHTML + } +} +``` + +Response: +```json +{ + "data": { + "getCar": { + "id": "82", + "contentThumbnailHTML": "\n" + } + } +} +``` \ No newline at end of file diff --git a/doc/10_GraphQL/08_Operators/Query/Concatenator.md b/doc/10_GraphQL/08_Operators/Query/Concatenator.md new file mode 100644 index 00000000..0b066d66 --- /dev/null +++ b/doc/10_GraphQL/08_Operators/Query/Concatenator.md @@ -0,0 +1,40 @@ +# Concatenator + +Concatenates the values of the selected fields. + +## Configuration + + + +![concat_config.png](../../../img/graphql/concat_config.png) + +- **Label**: Name for the field to use in the query. +- **Glue**: The string that will be used to concatenate the values. + +## Example + + + +![concat_example.png](../../../img/graphql/concat_example.png) + +Request: +```graphql +{ + getCar(id: 82) { + id, + ConcatYearCountry + } +} +``` + +Response: +```json +{ + "data": { + "getCar": { + "id": "82", + "ConcatYearCountry": "1966-GB" + } + } +} +``` \ No newline at end of file diff --git a/doc/10_GraphQL/08_Operators/Query/DateFormatter.md b/doc/10_GraphQL/08_Operators/Query/DateFormatter.md new file mode 100644 index 00000000..333aba40 --- /dev/null +++ b/doc/10_GraphQL/08_Operators/Query/DateFormatter.md @@ -0,0 +1,42 @@ +# Date Formatter + +Utilizes the PHP date formatter. + +## Configuration + + + +![date_formatter_config.png](../../../img/graphql/date_formatter_config.png) + +- **Label**: The name for the field to be used in the query . +- **Date Format**: The format you want to use. For formatting options see [PHP Date Format](https://www.php.net/manual/en/function.date.php). + +## Example + + + +![date_formatter_example.png](../../../img/graphql/date_formatter_example.png) + +Request: +```graphql +{ + getCar(id: 82) { + id, + modificationDate, + FormattedModificationDate + } +} +``` + +Response: +```json +{ + "data": { + "getCar": { + "id": "82", + "modificationDate": 1732709167, + "FormattedModificationDate": "Wednesday 27th of November 2024 12:06:07" + } + } +} +``` \ No newline at end of file diff --git a/doc/10_GraphQL/08_Operators/Query/ElementCounter.md b/doc/10_GraphQL/08_Operators/Query/ElementCounter.md new file mode 100644 index 00000000..0f67e4fb --- /dev/null +++ b/doc/10_GraphQL/08_Operators/Query/ElementCounter.md @@ -0,0 +1,41 @@ +# Element Counter + +Counts the elements assigned to the selected field. +Useful for counting the number of elements in a relation field. + +## Configuration + + + +![element_counter_config.png](../../../img/graphql/element_counter_config.png) + +- **Label**: Name for the field to use in the query. +- **Count Empty**: If checked, the operator will also count empty fields. + +## Example + + + +![element_counter_example.png](../../../img/graphql/element_counter_example.png) + +Request: +```graphql +{ + getCar(id: 82) { + id, + CategoriesCount + } +} +``` + +Response: +```json +{ + "data": { + "getCar": { + "id": "82", + "CategoriesCount": 2 + } + } +} +``` \ No newline at end of file diff --git a/doc/10_GraphQL/08_Operators/Query/Merge.md b/doc/10_GraphQL/08_Operators/Query/Merge.md new file mode 100644 index 00000000..55674c2a --- /dev/null +++ b/doc/10_GraphQL/08_Operators/Query/Merge.md @@ -0,0 +1,3 @@ +# Merge (deprecated) + +This operator is deprecated and will be removed in the next major release. diff --git a/doc/10_GraphQL/08_Operators/Query/StaticText.md b/doc/10_GraphQL/08_Operators/Query/StaticText.md new file mode 100644 index 00000000..c0002726 --- /dev/null +++ b/doc/10_GraphQL/08_Operators/Query/StaticText.md @@ -0,0 +1,39 @@ +# Static Text + +Adds the configured static text to the query. + +## Configuration + + + +![static_text_config.png](../../../img/graphql/static_text_config.png) + +- **Text**: The text to add to the query. + +## Example + + + +![static_text_example.png](../../../img/graphql/static_text_example.png) + +Request: +```graphql +{ + getCar(id: 82) { + id, + StaticTextForQuery + } +} +``` + +Result: +```json +{ + "data": { + "getCar": { + "id": "81", + "StaticTextForQuery": "StaticTextForQuery" + } + } +} +``` \ No newline at end of file diff --git a/doc/10_GraphQL/08_Operators/Query/Substring.md b/doc/10_GraphQL/08_Operators/Query/Substring.md new file mode 100644 index 00000000..1b40a8b8 --- /dev/null +++ b/doc/10_GraphQL/08_Operators/Query/Substring.md @@ -0,0 +1,44 @@ +# Substring + +This operator extracts a substring from a string. + +## Configuration + + + +![substring_config.png](../../../img/graphql/substring_config.png) + +- **FieldName**: Name for the field to use in the query. +- **Start**: The position of the first character to extract. +- **Length**: The number of characters to extract. +- **Ellipses**: If the string is longer than the specified length, an ellipsis is added at the end. + +## Example + + + +![substring_example.png](../../../img/graphql/substring_example.png) + +Request: +```graphql +{ + getCar(id: 82) { + id, + description, + ShortDescription + } +} +``` + +Response: +```json +{ + "data": { + "getCar": { + "id": "82", + "description": "Description that clearly exceeds 10 characters in length
", + "ShortDescription": "Descript..." + } + } +} +``` diff --git a/doc/10_GraphQL/08_Operators/Query/TranslateValue.md b/doc/10_GraphQL/08_Operators/Query/TranslateValue.md new file mode 100644 index 00000000..d04d0e7e --- /dev/null +++ b/doc/10_GraphQL/08_Operators/Query/TranslateValue.md @@ -0,0 +1,48 @@ +# Translate Value + +Translates the values of the selected fields. For translation the default locale is used. + +Similar to Pimcore's [Translate Value](https://pimcore.com/docs/6.x/User_Documentation/DataObjects/Grid_Configuration_Operators/Operators/TranslateValue.html). For a detailed example see [Website Translations](../../04_Query/11_Query_Samples/27_Sample_Translate_Values.md). + +## Configuration + +
+ +![translate_value_config.png](../../../img/graphql/translate_value_config.png) + +- **Label**: The label of the field. +- **Prefix**: The prefix for the translation key. + +## Example + + + +![translate_value_example.png](../../../img/graphql/translate_value_example.png) + +:::info + +Note: Make sure to add the translation key to the translations in the Pimcore backend, using the admin domain. + +::: + +Request: +```graphql +{ + getCar(id: 82) { + id, + TranslatedName + } +} +``` + +Response: +```json +{ + "data": { + "getCar": { + "id": "82", + "TranslatedName": "NameValuedAddedToTranslations" + } + } +} +``` diff --git a/doc/10_GraphQL/08_Operators/Query/Trimmer.md b/doc/10_GraphQL/08_Operators/Query/Trimmer.md new file mode 100644 index 00000000..458153f1 --- /dev/null +++ b/doc/10_GraphQL/08_Operators/Query/Trimmer.md @@ -0,0 +1,42 @@ +# Trimmer + +Trims the value. + +## Configuration + + + +![trim_config.png](../../../img/graphql/trim_config.png) + +- **Label**: Name for the field to use in the query. +- **Trim**: Where to trim, either `both`, `left`, `right` or `disabled`. + +## Example + + + +![trim_example.png](../../../img/graphql/trim_example.png) + +Request: +```graphql +{ + getCar(id: 82) { + id, + name, + TrimmedName + } +} +``` + +Response: +```json +{ + "data": { + "getCar": { + "id": "82", + "name": " Cobra 427 ", + "TrimmedName": " Cobra 427" + } + } +} +``` \ No newline at end of file diff --git a/doc/10_GraphQL/08_Operators/README.md b/doc/10_GraphQL/08_Operators/README.md new file mode 100644 index 00000000..8314acf2 --- /dev/null +++ b/doc/10_GraphQL/08_Operators/README.md @@ -0,0 +1,21 @@ +# Operators + +Operators allow to modify and transform the data before it is delivered to the endpoint or stored in Pimcore, +depending on whether they are used in a query or a mutation. + + + +![Overview](../../img/graphql/queryoperators_overview.png) + +Operators can be selected in the GraphQL configuration using the `Schema Definition` tab. +In the `Query Schema` section use the `gear` icon to open the configuration dialog for a data object class you want to use in queries. +In the `Mutation Schema` section use the `gear` icon to open the configuration dialog for a data object class you want to use in mutations. + +This will open the `Schema Fields` configuration dialog where you can select the fields you want to use in queries or mutations. +In the tree on the left side you can select th operators you want to use by clicking on one of the 3 tabs: `Formatters`, `Others` or `Transformers`. + +Add an operator by double-clicking on it or by dragging it to the right side of the dialog. +Depending on the operator an options dialog will open where you can configure the operator. +After adding an operator you can drag & drop fields under the operator to apply the operator to them. + +Please see the contents of this chapter for more information on the available operators. \ No newline at end of file diff --git a/doc/10_GraphQL/README.md b/doc/10_GraphQL/README.md index 866aeeb4..e151be9e 100644 --- a/doc/10_GraphQL/README.md +++ b/doc/10_GraphQL/README.md @@ -12,6 +12,8 @@ and services via GraphQL and test them with the integrated [![Preview](../img/graphql/intro_preview.png)](../img/graphql/intro.mp4) + + ![Explorer](../img/graphql/iexplorer.png) @@ -61,6 +63,8 @@ See following pages for a general overview of possible mutations: [GraphiQL explorer](https://github.com/graphql/graphiql/tree/main/packages/graphiql#readme) can be opened for an endpoint in an iframe within Pimcore or as an additional browser tab. + + ![Open iExplorer](../img/graphql/open_explorer.png) @@ -94,4 +98,6 @@ see [Events Documentation](./10_Events.md). Open the settings and change `request.credentials` to `include`. Otherwise the `XDEBUG_SESSION` cookie header will get removed by default. + + ![Settings](../img/graphql/debugging.png) diff --git a/doc/20_Deployment.md b/doc/20_Deployment.md index cbd6208d..cb521efa 100644 --- a/doc/20_Deployment.md +++ b/doc/20_Deployment.md @@ -14,7 +14,7 @@ When deploying configurations following steps are necessary: Either call: ```bash datahub:configuration:rebuild-workspaces -``` +``` to do that for all definitions, or: @@ -23,7 +23,11 @@ datahub:configuration:rebuild-workspaces --configs=assets,events ``` for specific definitions. ->Note: The command ```datahub:graphql:rebuild-definitions ``` is marked as deprecated and will be removed in a future release. +:::warning + +Note: The command ```datahub:graphql:rebuild-definitions ``` is marked as deprecated and will be removed in a future release. + +::: ### Configuration Storage diff --git a/doc/img/graphql/advanced_many_to_many_object_relation.png b/doc/img/graphql/advanced_many_to_many_object_relation.png index 1471879e..8f32b5ef 100644 Binary files a/doc/img/graphql/advanced_many_to_many_object_relation.png and b/doc/img/graphql/advanced_many_to_many_object_relation.png differ diff --git a/doc/img/graphql/advanced_many_to_many_object_relation2.png b/doc/img/graphql/advanced_many_to_many_object_relation2.png index a188dc64..43f13cd2 100644 Binary files a/doc/img/graphql/advanced_many_to_many_object_relation2.png and b/doc/img/graphql/advanced_many_to_many_object_relation2.png differ diff --git a/doc/img/graphql/alias_config.png b/doc/img/graphql/alias_config.png new file mode 100644 index 00000000..4e732c6c Binary files /dev/null and b/doc/img/graphql/alias_config.png differ diff --git a/doc/img/graphql/alias_example.png b/doc/img/graphql/alias_example.png new file mode 100644 index 00000000..8a4a0ffa Binary files /dev/null and b/doc/img/graphql/alias_example.png differ diff --git a/doc/img/graphql/concat_config.png b/doc/img/graphql/concat_config.png new file mode 100644 index 00000000..657a833a Binary files /dev/null and b/doc/img/graphql/concat_config.png differ diff --git a/doc/img/graphql/concat_example.png b/doc/img/graphql/concat_example.png new file mode 100644 index 00000000..f7f085c0 Binary files /dev/null and b/doc/img/graphql/concat_example.png differ diff --git a/doc/img/graphql/configuration2.png b/doc/img/graphql/configuration2.png deleted file mode 100644 index 410e4b4b..00000000 Binary files a/doc/img/graphql/configuration2.png and /dev/null differ diff --git a/doc/img/graphql/dataobject_structure.png b/doc/img/graphql/dataobject_structure.png deleted file mode 100644 index e35e459b..00000000 Binary files a/doc/img/graphql/dataobject_structure.png and /dev/null differ diff --git a/doc/img/graphql/date_formatter.png b/doc/img/graphql/date_formatter.png deleted file mode 100644 index 84e00ee0..00000000 Binary files a/doc/img/graphql/date_formatter.png and /dev/null differ diff --git a/doc/img/graphql/date_formatter_config.png b/doc/img/graphql/date_formatter_config.png new file mode 100644 index 00000000..32224c74 Binary files /dev/null and b/doc/img/graphql/date_formatter_config.png differ diff --git a/doc/img/graphql/date_formatter_example.png b/doc/img/graphql/date_formatter_example.png new file mode 100644 index 00000000..2545a65e Binary files /dev/null and b/doc/img/graphql/date_formatter_example.png differ diff --git a/doc/img/graphql/element_counter_config.png b/doc/img/graphql/element_counter_config.png new file mode 100644 index 00000000..cb18dad1 Binary files /dev/null and b/doc/img/graphql/element_counter_config.png differ diff --git a/doc/img/graphql/element_counter_example.png b/doc/img/graphql/element_counter_example.png new file mode 100644 index 00000000..792d9784 Binary files /dev/null and b/doc/img/graphql/element_counter_example.png differ diff --git a/doc/img/graphql/ifempty_config.png b/doc/img/graphql/ifempty_config.png new file mode 100644 index 00000000..532e221f Binary files /dev/null and b/doc/img/graphql/ifempty_config.png differ diff --git a/doc/img/graphql/ifempty_example.png b/doc/img/graphql/ifempty_example.png new file mode 100644 index 00000000..6bf23b72 Binary files /dev/null and b/doc/img/graphql/ifempty_example.png differ diff --git a/doc/img/graphql/locale_collector_config.png b/doc/img/graphql/locale_collector_config.png new file mode 100644 index 00000000..39179d6f Binary files /dev/null and b/doc/img/graphql/locale_collector_config.png differ diff --git a/doc/img/graphql/locale_collector_example.png b/doc/img/graphql/locale_collector_example.png new file mode 100644 index 00000000..de87f064 Binary files /dev/null and b/doc/img/graphql/locale_collector_example.png differ diff --git a/doc/img/graphql/locale_switcher_config.png b/doc/img/graphql/locale_switcher_config.png new file mode 100644 index 00000000..46892df3 Binary files /dev/null and b/doc/img/graphql/locale_switcher_config.png differ diff --git a/doc/img/graphql/locale_switcher_example.png b/doc/img/graphql/locale_switcher_example.png new file mode 100644 index 00000000..07d2ed52 Binary files /dev/null and b/doc/img/graphql/locale_switcher_example.png differ diff --git a/doc/img/graphql/logo_mini.png b/doc/img/graphql/logo_mini.png deleted file mode 100644 index 71e0f028..00000000 Binary files a/doc/img/graphql/logo_mini.png and /dev/null differ diff --git a/doc/img/graphql/many2many.png b/doc/img/graphql/many2many.png index 8ef5f6d0..2383c71c 100644 Binary files a/doc/img/graphql/many2many.png and b/doc/img/graphql/many2many.png differ diff --git a/doc/img/graphql/many2many_data.png b/doc/img/graphql/many2many_data.png new file mode 100644 index 00000000..c822cd32 Binary files /dev/null and b/doc/img/graphql/many2many_data.png differ diff --git a/doc/img/graphql/mutation_grid.png b/doc/img/graphql/mutation_grid.png index 314d0eeb..971750ed 100644 Binary files a/doc/img/graphql/mutation_grid.png and b/doc/img/graphql/mutation_grid.png differ diff --git a/doc/img/graphql/operator_concatenator.png b/doc/img/graphql/operator_concatenator.png deleted file mode 100644 index 819bd9e1..00000000 Binary files a/doc/img/graphql/operator_concatenator.png and /dev/null differ diff --git a/doc/img/graphql/operator_elementcounter1.png b/doc/img/graphql/operator_elementcounter1.png deleted file mode 100644 index b6160035..00000000 Binary files a/doc/img/graphql/operator_elementcounter1.png and /dev/null differ diff --git a/doc/img/graphql/operator_thumbnail.png b/doc/img/graphql/operator_thumbnail.png deleted file mode 100644 index f3f48e06..00000000 Binary files a/doc/img/graphql/operator_thumbnail.png and /dev/null differ diff --git a/doc/img/graphql/security1.png b/doc/img/graphql/security1.png index e2358c63..5702d294 100644 Binary files a/doc/img/graphql/security1.png and b/doc/img/graphql/security1.png differ diff --git a/doc/img/graphql/static_text_config.png b/doc/img/graphql/static_text_config.png new file mode 100644 index 00000000..3d4cd489 Binary files /dev/null and b/doc/img/graphql/static_text_config.png differ diff --git a/doc/img/graphql/static_text_example.png b/doc/img/graphql/static_text_example.png new file mode 100644 index 00000000..93dc163d Binary files /dev/null and b/doc/img/graphql/static_text_example.png differ diff --git a/doc/img/graphql/substring_config.png b/doc/img/graphql/substring_config.png new file mode 100644 index 00000000..99782810 Binary files /dev/null and b/doc/img/graphql/substring_config.png differ diff --git a/doc/img/graphql/substring_example.png b/doc/img/graphql/substring_example.png new file mode 100644 index 00000000..073b2ee0 Binary files /dev/null and b/doc/img/graphql/substring_example.png differ diff --git a/doc/img/graphql/thumbnail_config.png b/doc/img/graphql/thumbnail_config.png new file mode 100644 index 00000000..5af7303a Binary files /dev/null and b/doc/img/graphql/thumbnail_config.png differ diff --git a/doc/img/graphql/thumbnail_example.png b/doc/img/graphql/thumbnail_example.png new file mode 100644 index 00000000..f70ff680 Binary files /dev/null and b/doc/img/graphql/thumbnail_example.png differ diff --git a/doc/img/graphql/thumbnail_html_config.png b/doc/img/graphql/thumbnail_html_config.png new file mode 100644 index 00000000..3f3f220e Binary files /dev/null and b/doc/img/graphql/thumbnail_html_config.png differ diff --git a/doc/img/graphql/thumbnail_html_example.png b/doc/img/graphql/thumbnail_html_example.png new file mode 100644 index 00000000..7924f699 Binary files /dev/null and b/doc/img/graphql/thumbnail_html_example.png differ diff --git a/doc/img/graphql/translate_value_config.png b/doc/img/graphql/translate_value_config.png new file mode 100644 index 00000000..faf7d6e5 Binary files /dev/null and b/doc/img/graphql/translate_value_config.png differ diff --git a/doc/img/graphql/translate_value_example.png b/doc/img/graphql/translate_value_example.png new file mode 100644 index 00000000..e09da110 Binary files /dev/null and b/doc/img/graphql/translate_value_example.png differ diff --git a/doc/img/graphql/trim_config.png b/doc/img/graphql/trim_config.png new file mode 100644 index 00000000..2eaaa78b Binary files /dev/null and b/doc/img/graphql/trim_config.png differ diff --git a/doc/img/graphql/trim_example.png b/doc/img/graphql/trim_example.png new file mode 100644 index 00000000..29a53192 Binary files /dev/null and b/doc/img/graphql/trim_example.png differ