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/.artifacts/cms/5.x/addresses.md
+29-9Lines changed: 29 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -43,8 +43,8 @@
43
43
| [orderBy](#orderby) | Determines the order that the addresses should be returned in. (If empty, defaults to `dateCreated DESC, elements.id`.)
44
44
| [organization](#organization) | Narrows the query results based on the organization the addresses have.
45
45
| [organizationTaxId](#organizationtaxid) | Narrows the query results based on the tax ID the addresses have.
46
-
| [owner](#owner) | Sets the [ownerId](#ownerid)parameter based on a given owner element.
47
-
| [ownerId](#ownerid) | Narrows the query results based on the addresses’ owner elements, per their IDs.
46
+
| [owner](#owner) | Sets the [ownerId](#ownerid)and [siteId()](https://docs.craftcms.com/api/v5/craft-elements-db-elementquery.html#method-siteid) parameters based on a given element.
47
+
| [ownerId](#ownerid) | Narrows the query results based on the owner element of the addresses, per the owners’ IDs.
48
48
| [postalCode](#postalcode) | Narrows the query results based on the postal code the addresses belong to.
49
49
| [preferSites](#prefersites) | If [unique()](https://docs.craftcms.com/api/v5/craft-elements-db-elementquery.html#method-unique) is set, this determines which site should be selected when querying multi-site elements.
50
50
| [prepForEagerLoading](#prepforeagerloading) | Prepares the query for lazy eager loading.
@@ -209,6 +209,8 @@ Performs any post-population processing on elements.
209
209
210
210
Narrows the query results based on whether the addresses’ owners are drafts.
211
211
212
+
213
+
212
214
Possible values include:
213
215
214
216
| Value | Fetches addresses…
@@ -219,10 +221,14 @@ Possible values include:
219
221
220
222
221
223
224
+
225
+
222
226
#### `allowOwnerRevisions`
223
227
224
228
Narrows the query results based on whether the addresses’ owners are revisions.
225
229
230
+
231
+
226
232
Possible values include:
227
233
228
234
| Value | Fetches addresses…
@@ -233,6 +239,8 @@ Possible values include:
233
239
234
240
235
241
242
+
243
+
236
244
#### `andNotRelatedTo`
237
245
238
246
Narrows the query results to only addresses that are not related to certain other elements.
@@ -497,13 +505,15 @@ and any other elements in its collection.
497
505
498
506
Narrows the query results based on the field the addresses are contained by.
499
507
508
+
509
+
500
510
Possible values include:
501
511
502
512
| Value | Fetches addresses…
503
513
| - | -
504
514
| `'foo'` | in a field with a handle of `foo`.
505
515
| `['foo', 'bar']` | in a field with a handle of `foo` or `bar`.
506
-
| an`\craft\elements\db\craft\fields\Addresses` object | in a field represented by the object.
516
+
| a`\craft\elements\db\craft\fields\Matrix` object | in a field represented by the object.
Sets the [ownerId](#ownerid) parameter based on a given owner element.
1017
+
Sets the [ownerId](#ownerid) and [siteId()](https://docs.craftcms.com/api/v5/craft-elements-db-elementquery.html#method-siteid) parameters based on a given element.
1018
+
1019
+
1006
1020
1007
1021
1008
1022
1009
1023
::: code
1010
1024
```twig
1011
-
{# Fetch addresses for the current user #}
1025
+
{# Fetch addresses created for this entry #}
1012
1026
{% set addresses = craft.addresses()
1013
-
.owner(currentUser)
1027
+
.owner(myEntry)
1014
1028
.all() %}
1015
1029
```
1016
1030
1017
1031
```php
1018
-
// Fetch addresses created for the current user
1032
+
// Fetch addresses created for this entry
1019
1033
$addresses = \craft\elements\Address::find()
1020
-
->owner(Craft::$app->user->identity)
1034
+
->owner($myEntry)
1021
1035
->all();
1022
1036
```
1023
1037
:::
1024
1038
1025
1039
1026
1040
#### `ownerId`
1027
1041
1028
-
Narrows the query results based on the addresses’ owner elements, per their IDs.
1042
+
Narrows the query results based on the owner element of the addresses, per the owners’ IDs.
1043
+
1044
+
1029
1045
1030
1046
Possible values include:
1031
1047
@@ -1147,6 +1163,8 @@ Sets the [primaryOwnerId](#primaryownerid) and [siteId()](https://docs.craftcms.
0 commit comments