Skip to content

Commit

Permalink
Updated documentation for advanced relations
Browse files Browse the repository at this point in the history
  • Loading branch information
mcop1 committed Nov 28, 2024
1 parent 07ac61e commit b8cef63
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 95 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Advanced Many-to-Many Object Relation and Metadata

>TODO: Align this with the new demo as soon as reasonable content is available.
Data Model:
Data Model for class `AccessoryPart`:

<div class="image-as-lightbox"></div>

Expand All @@ -24,17 +22,16 @@ Note that the response differs from `Advanced Many-to-Many Relations` as there c

```
{
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
}
}
Expand All @@ -44,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"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,43 @@

![Metadata](../../../img/graphql/many2many.png)

>TODO: Align this with the new demo as soon as reasonable content is available.
Data:

<div class="image-as-lightbox"></div>

![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
}
}
Expand All @@ -30,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"
}
]
}
]
}
]
}
}
}
```

Expand Down
Binary file modified doc/img/graphql/advanced_many_to_many_object_relation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/img/graphql/advanced_many_to_many_object_relation2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/img/graphql/many2many.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/graphql/many2many_data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b8cef63

Please sign in to comment.