Skip to content

Commit 0bdbd7c

Browse files
Update fetching.md
The proposed changes make reference to 3 methods found in system/ee/ExpressionEngine/Service/Model/Query/Builder.php: filterGroup(), orFilterGroup(), and endFilterGroup() which have not been documented. I stumbled upon these working on a small plugin and wanted to find a more advanced/complex method using the Model service than having to write a Query directly. A basic example also provided for its usage. Small change also made to remove a reference to "group_id" on a Member model example just to keep it consistent with the new Role based system.
1 parent ae57472 commit 0bdbd7c

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

docs/development/services/model/fetching.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,17 @@ The operator is optional and will default to `==` if not given:
4646
By default, filters will be chained as `AND` conditions. An `OR` filter can be applied by using the `orFilter()` method:
4747

4848
->filter('username' 'bob')
49-
->orFilter('group_id', 1)
49+
->orFilter('role_id', 1)
50+
51+
For more complex calls, filters can be grouped by using the `filterGroup()`, `orFilterGroup()`, and `endFilterGroup()` methods:
52+
53+
// filter members who have less than 10 entries AND either have a primary role_id of 1 OR 2.
54+
->filter('total_entries', '<', '10')
55+
->filterGroup()
56+
->filter('role_id', '1')
57+
->orFilter('role_id', '2')
58+
->endFilterGroup()
59+
5060

5161
### Available filters
5262

0 commit comments

Comments
 (0)