### Model.beforeFind event
Each find() will trigger a Model.beforeFind event for all attached
listeners. Any listener can set a valid result set using $query
By default, $options will recognize the following keys:
- fields
- conditions
- order
- limit
- offset
- page
- group
- having
- contain
- join
### Usage
Using the options array:
$query = $articles->find('all', [
'conditions' => ['published' => 1],
'limit' => 10,
'contain' => ['Users', 'Comments']
]);
Using the builder interface:
$query = $articles->find()
->where(['published' => 1])
->limit(10)
->contain(['Users', 'Comments']);
### Calling finders
The find() method is the entry point for custom finder methods.
You can invoke a finder by specifying the type:
$query = $articles->find('published');
Would invoke the findPublished method.
public find ( $type = 'all', $options = [] ) : |
||
return | The query builder |