|
9 | 9 | | Param | Description
|
10 | 10 | | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
11 | 11 | | [afterPopulate](#afterpopulate) | Performs any post-population processing on elements.
|
| 12 | +| [andNotRelatedTo](#andnotrelatedto) | Narrows the query results to only subscriptions that are not related to certain other elements. |
12 | 13 | | [andRelatedTo](#andrelatedto) | Narrows the query results to only subscriptions that are related to certain other elements.
|
13 | 14 | | [asArray](#asarray) | Causes the query to return matching subscriptions as arrays of data, rather than [Subscription](commerce5:craft\commerce\elements\Subscription) objects.
|
14 | 15 | | [cache](#cache) | Enables query cache for this Query.
|
15 |
| -| [clearCachedResult](#clearcachedresult) | Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache). |
| 16 | +| [clearCachedResult](#clearcachedresult) | Clears the [cached result](https://craftcms.com/docs/5.x/development/element-queries.html#cache). |
16 | 17 | | [dateCanceled](#datecanceled) | Narrows the query results based on the subscriptions’ cancellation date.
|
17 | 18 | | [dateCreated](#datecreated) | Narrows the query results based on the subscriptions’ creation dates.
|
18 | 19 | | [dateExpired](#dateexpired) | Narrows the query results based on the subscriptions’ expiration date.
|
|
32 | 33 | | [language](#language) | Determines which site(s) the subscriptions should be queried in, based on their language.
|
33 | 34 | | [limit](#limit) | Determines the number of subscriptions that should be returned.
|
34 | 35 | | [nextPaymentDate](#nextpaymentdate) | Narrows the query results based on the subscriptions’ next payment dates.
|
| 36 | +| [notRelatedTo](#notrelatedto) | Narrows the query results to only subscriptions that are not related to certain other elements. |
35 | 37 | | [offset](#offset) | Determines how many subscriptions should be skipped in the results.
|
36 | 38 | | [onTrial](#ontrial) | Narrows the query results to only subscriptions that are on trial.
|
37 | 39 | | [orderBy](#orderby) | Determines the order that the subscriptions should be returned in. (If empty, defaults to `dateCreated DESC`.)
|
@@ -74,13 +76,42 @@ Performs any post-population processing on elements.
|
74 | 76 |
|
75 | 77 |
|
76 | 78 |
|
| 79 | +#### `andNotRelatedTo` |
| 80 | + |
| 81 | +Narrows the query results to only subscriptions that are not related to certain other elements. |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | +See [Relations](https://craftcms.com/docs/5.x/system/relations.html) for a full explanation of how to work with this parameter. |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | +::: code |
| 90 | +```twig |
| 91 | +{# Fetch all subscriptions that are related to myCategoryA and not myCategoryB #} |
| 92 | +{% set subscriptions = craft.subscriptions() |
| 93 | + .relatedTo(myCategoryA) |
| 94 | + .andNotRelatedTo(myCategoryB) |
| 95 | + .all() %} |
| 96 | +``` |
| 97 | + |
| 98 | +```php |
| 99 | +// Fetch all subscriptions that are related to $myCategoryA and not $myCategoryB |
| 100 | +$subscriptions = \craft\commerce\elements\Subscription::find() |
| 101 | + ->relatedTo($myCategoryA) |
| 102 | + ->andNotRelatedTo($myCategoryB) |
| 103 | + ->all(); |
| 104 | +``` |
| 105 | +::: |
| 106 | + |
| 107 | + |
77 | 108 | #### `andRelatedTo`
|
78 | 109 |
|
79 | 110 | Narrows the query results to only subscriptions that are related to certain other elements.
|
80 | 111 |
|
81 | 112 |
|
82 | 113 |
|
83 |
| -See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter. |
| 114 | +See [Relations](https://craftcms.com/docs/5.x/system/relations.html) for a full explanation of how to work with this parameter. |
84 | 115 |
|
85 | 116 |
|
86 | 117 |
|
@@ -143,7 +174,7 @@ Enables query cache for this Query.
|
143 | 174 |
|
144 | 175 | #### `clearCachedResult`
|
145 | 176 |
|
146 |
| -Clears the [cached result](https://craftcms.com/docs/4.x/element-queries.html#cache). |
| 177 | +Clears the [cached result](https://craftcms.com/docs/5.x/development/element-queries.html#cache). |
147 | 178 |
|
148 | 179 |
|
149 | 180 |
|
@@ -673,6 +704,33 @@ $subscriptions = \craft\commerce\elements\Subscription::find()
|
673 | 704 | :::
|
674 | 705 |
|
675 | 706 |
|
| 707 | +#### `notRelatedTo` |
| 708 | + |
| 709 | +Narrows the query results to only subscriptions that are not related to certain other elements. |
| 710 | + |
| 711 | + |
| 712 | + |
| 713 | +See [Relations](https://craftcms.com/docs/5.x/system/relations.html) for a full explanation of how to work with this parameter. |
| 714 | + |
| 715 | + |
| 716 | + |
| 717 | +::: code |
| 718 | +```twig |
| 719 | +{# Fetch all subscriptions that are related to myEntry #} |
| 720 | +{% set subscriptions = craft.subscriptions() |
| 721 | + .notRelatedTo(myEntry) |
| 722 | + .all() %} |
| 723 | +``` |
| 724 | + |
| 725 | +```php |
| 726 | +// Fetch all subscriptions that are related to $myEntry |
| 727 | +$subscriptions = \craft\commerce\elements\Subscription::find() |
| 728 | + ->notRelatedTo($myEntry) |
| 729 | + ->all(); |
| 730 | +``` |
| 731 | +::: |
| 732 | + |
| 733 | + |
676 | 734 | #### `offset`
|
677 | 735 |
|
678 | 736 | Determines how many subscriptions should be skipped in the results.
|
@@ -876,7 +934,7 @@ Narrows the query results to only subscriptions that are related to certain othe
|
876 | 934 |
|
877 | 935 |
|
878 | 936 |
|
879 |
| -See [Relations](https://craftcms.com/docs/4.x/relations.html) for a full explanation of how to work with this parameter. |
| 937 | +See [Relations](https://craftcms.com/docs/5.x/system/relations.html) for a full explanation of how to work with this parameter. |
880 | 938 |
|
881 | 939 |
|
882 | 940 |
|
@@ -912,7 +970,7 @@ Narrows the query results to only subscriptions that match a search query.
|
912 | 970 |
|
913 | 971 |
|
914 | 972 |
|
915 |
| -See [Searching](https://craftcms.com/docs/4.x/searching.html) for a full explanation of how to work with this parameter. |
| 973 | +See [Searching](https://craftcms.com/docs/5.x/system/searching.html) for a full explanation of how to work with this parameter. |
916 | 974 |
|
917 | 975 |
|
918 | 976 |
|
@@ -1158,7 +1216,7 @@ Causes the query to return matching subscriptions eager-loaded with related elem
|
1158 | 1216 |
|
1159 | 1217 |
|
1160 | 1218 |
|
1161 |
| -See [Eager-Loading Elements](https://craftcms.com/docs/4.x/dev/eager-loading-elements.html) for a full explanation of how to work with this parameter. |
| 1219 | +See [Eager-Loading Elements](https://craftcms.com/docs/5.x/development/eager-loading.html) for a full explanation of how to work with this parameter. |
1162 | 1220 |
|
1163 | 1221 |
|
1164 | 1222 |
|
|
0 commit comments