You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/relationships.md
+24-24Lines changed: 24 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,15 +3,15 @@
3
3
[[toc]]
4
4
5
5
This chapter describes how the GraphQL-Plugin interacts with relationships. All relationships work out of the box.
6
-
We take the examples from the [Vuex-ORM documentation for definition relationships](https://vuex-orm.github.io/vuex-orm/relationships/defining-relationships.html)
6
+
We take the examples from the [Vuex-ORM documentation for definition relationships](https://vuex-orm.github.io/vuex-orm/guide/relationships/defining-relationships.html)
7
7
and show what GraphQL queries will be generated.
8
8
9
9
10
10
## One To One
11
11
12
12
::: tip
13
-
See the [One To One section](https://vuex-orm.github.io/vuex-orm/relationships/defining-relationships.html#one-to-one) in the Vuex-ORM documentation.
14
-
:::
13
+
See the [One To One section](https://vuex-orm.github.io/vuex-orm/guide/relationships/defining-relationships.html#one-to-one) in the Vuex-ORM documentation.
14
+
:::
15
15
16
16
Is eager loaded automatically.
17
17
@@ -52,7 +52,7 @@ query Users {
52
52
nodes {
53
53
id
54
54
name
55
-
55
+
56
56
profile {
57
57
id
58
58
age
@@ -73,7 +73,7 @@ query Profiles {
73
73
age
74
74
sex
75
75
userId
76
-
76
+
77
77
user {
78
78
id
79
79
name
@@ -86,10 +86,10 @@ query Profiles {
86
86
## One To Many
87
87
88
88
::: tip
89
-
See the [One To Many section](https://vuex-orm.github.io/vuex-orm/relationships/defining-relationships.html#one-to-many) in the Vuex-ORM documentation.
90
-
:::
89
+
See the [One To Many section](https://vuex-orm.github.io/vuex-orm/guide/relationships/defining-relationships.html#one-to-many) in the Vuex-ORM documentation.
90
+
:::
91
91
92
-
BelongsTo is eager loaded automatically while HasMany is not eager loaded.
92
+
BelongsTo is eager loaded automatically while HasMany is not eager loaded.
93
93
94
94
**Models:**
95
95
```javascript
@@ -128,7 +128,7 @@ query Comments {
128
128
id
129
129
postId
130
130
content
131
-
131
+
132
132
post {
133
133
id
134
134
content
@@ -160,8 +160,8 @@ As you can see the comments are not eager loaded.
160
160
## Many To Many
161
161
162
162
::: tip
163
-
See the [Many To Many section](https://vuex-orm.github.io/vuex-orm/relationships/defining-relationships.html#many-to-many) in the Vuex-ORM documentation.
164
-
:::
163
+
See the [Many To Many section](https://vuex-orm.github.io/vuex-orm/guide/relationships/defining-relationships.html#many-to-many) in the Vuex-ORM documentation.
164
+
:::
165
165
166
166
Is NOT eager loaded automatically, so we add a eagerLoad field to User.
167
167
@@ -213,7 +213,7 @@ query Users {
213
213
nodes {
214
214
id
215
215
email
216
-
216
+
217
217
roles {
218
218
nodes {
219
219
id
@@ -244,13 +244,13 @@ query Roles {
244
244
## Has Many Through
245
245
246
246
::: tip
247
-
See the [Has Any Through section](https://vuex-orm.github.io/vuex-orm/relationships/defining-relationships.html#has-many-through) in the Vuex-ORM documentation.
248
-
:::
247
+
See the [Has Any Through section](https://vuex-orm.github.io/vuex-orm/guide/relationships/defining-relationships.html#has-many-through) in the Vuex-ORM documentation.
248
+
:::
249
249
250
250
Is NOT eager loaded automatically.
251
251
252
252
In this example we have a Product which can belong to many ProductGroups. And a ProductGroup can have many Products.
253
-
This is a classical n:m relation type, which we setup via HasManyThrough and a Pivot Model (ProductsProductGroup)
253
+
This is a classical n:m relation type, which we setup via HasManyThrough and a Pivot Model (ProductsProductGroup)
254
254
255
255
**Models:**
256
256
```javascript
@@ -316,7 +316,7 @@ query Users {
316
316
id
317
317
email
318
318
countryId
319
-
319
+
320
320
country {
321
321
id
322
322
name
@@ -334,12 +334,12 @@ query Posts {
334
334
id
335
335
title
336
336
content
337
-
337
+
338
338
user {
339
339
id
340
340
email
341
341
countryId
342
-
342
+
343
343
country {
344
344
id
345
345
name
@@ -354,8 +354,8 @@ query Posts {
354
354
## Polymorphic Relations
355
355
356
356
::: tip
357
-
See the [Polymorphic Relations section](https://vuex-orm.github.io/vuex-orm/relationships/defining-relationships.html#polymorphic-relations) in the Vuex-ORM documentation.
358
-
:::
357
+
See the [Polymorphic Relations section](https://vuex-orm.github.io/vuex-orm/guide/relationships/defining-relationships.html#polymorphic-relations) in the Vuex-ORM documentation.
358
+
:::
359
359
360
360
Eager loading behaves like in a normal One To Many or One to One. So we add a `eagerLoad` field to make sure the
361
361
comments are loaded automatically with the post or video.
@@ -412,7 +412,7 @@ query Posts {
412
412
id
413
413
title
414
414
content
415
-
415
+
416
416
comments {
417
417
nodes {
418
418
id
@@ -430,8 +430,8 @@ query Posts {
430
430
## Many To Many Polymorphic Relations
431
431
432
432
::: tip
433
-
See the [Many To Many Polymorphic Relations section](https://vuex-orm.github.io/vuex-orm/relationships/defining-relationships.html#many-to-many-polymorphic-relations) in the Vuex-ORM documentation.
434
-
:::
433
+
See the [Many To Many Polymorphic Relations section](https://vuex-orm.github.io/vuex-orm/guide/relationships/defining-relationships.html#many-to-many-polymorphic-relations) in the Vuex-ORM documentation.
434
+
:::
435
435
436
436
Eager loading behaves the same as in a normal Many To Many: Nothing is eager loaded automatically. So we add a
437
437
`eagerLoad` field to make sure the tags are loaded automatically with the post or video.
After that we setup the plugin. Add this after [registering your models to the database](https://vuex-orm.github.io/vuex-orm/prologue/getting-started.html#register-models-and-modules-to-the-vuex-store):
21
+
After that we setup the plugin. Add this after [registering your models to the database](https://vuex-orm.github.io/vuex-orm/guide/prologue/getting-started.html#register-models-and-modules-to-the-vuex-store):
@@ -37,7 +37,7 @@ These are the possible options to pass when calling `VuexORM.use()`:
37
37
This can be a static object or a function, returning a object, which will be called before a request is made.
38
38
-`credentials` (optional, default: `same-origin`) Credentials Policy. See [apollo-link-http])(https://github.com/apollographql/apollo-link/tree/master/packages/apollo-link-http#options)
39
39
-`useGETForQueries` (optional, default: `false`) Use GET for queries (not for mutations). See [apollo-link-http])(https://github.com/apollographql/apollo-link/tree/master/packages/apollo-link-http#options)
40
-
-`connectionQueryMode` (optional, default: `auto`). One of `auto | nodes | edges | plain`. See [Connection Mode](/guide/connection-mode)
40
+
-`connectionQueryMode` (optional, default: `auto`). One of `auto | nodes | edges | plain`. See [Connection Mode](connection-mode.md)
0 commit comments