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: en/orm/retrieving-data-and-resultsets.rst
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -145,6 +145,16 @@ You can also provide many commonly used options to ``find()``::
145
145
limit: 10
146
146
);
147
147
148
+
If your finder options are in an array, you can use the `splat operator <https://www.php.net/manual/en/functions.arguments.php#functions.variable-arg-list>`_ (``...``)
149
+
to pass them into ``find()``::
150
+
151
+
$options = [
152
+
'conditions' => ['Articles.created >' => new DateTime('-10 days')],
153
+
'contain' => ['Authors', 'Comments'],
154
+
'limit' => 10,
155
+
]
156
+
$query = $articles->find('all', ...$options);
157
+
148
158
The list of named arguments supported by find() by default are:
149
159
150
160
- ``conditions`` provide conditions for the WHERE clause of your query.
@@ -160,7 +170,7 @@ The list of named arguments supported by find() by default are:
160
170
- ``join`` define additional custom joins.
161
171
- ``order`` order the result set.
162
172
163
-
Any options that are not in this list will be passed to beforeFind listeners
173
+
Any options that are not in this list will be passed to ``beforeFind`` listeners
164
174
where they can be used to modify the query object. You can use the
165
175
``getOptions()`` method on a query object to retrieve the options used. While
166
176
you can pass query objects to your controllers, we recommend that you package
0 commit comments