diff --git a/cake/libs/model/model.php b/cake/libs/model/model.php index d2b6d94d1f0..f99f75c7c63 100644 --- a/cake/libs/model/model.php +++ b/cake/libs/model/model.php @@ -1997,7 +1997,7 @@ function hasAny($conditions = null) { } /** - * Returns a result set array. + * Queries the datasource and returns a result set array. * * Also used to perform new-notation finds, where the first argument is type of find operation to perform * (all / first / count / neighbors / list / threaded ), @@ -2006,8 +2006,8 @@ function hasAny($conditions = null) { * * Eg: * {{{ - * find('all', array( - * 'conditions' => array('name' => 'Thomas Anderson'), + * find('all', array( + * 'conditions' => array('name' => 'Thomas Anderson'), * 'fields' => array('name', 'email'), * 'order' => 'field3 DESC', * 'recursive' => 2, @@ -2015,6 +2015,24 @@ function hasAny($conditions = null) { * )); * }}} * + * In addition to the standard query keys above, you can provide Datasource, and behavior specific + * keys. For example, when using a SQL based datasource you can use the joins key to specify additional + * joins that should be part of the query. + * + * {{{ + * find('all', array( + * 'conditions' => array('name' => 'Thomas Anderson'), + * 'joins' => array( + * 'alias' => 'Thought', + * 'table' => 'thoughts', + * 'type' => 'LEFT', + * 'conditions' => '`Thought`.`person_id` = `Person`.`id`' + * ) + * )); + * }}} + * + * Behaviors and find types can also define custom finder keys which are passed into find(). + * * Specifying 'fields' for new-notation 'list': * * - If no fields are specified, then 'id' is used for key and 'model->displayField' is used for value. @@ -2023,9 +2041,9 @@ function hasAny($conditions = null) { * - Otherwise, first and second fields are used for key and value. * * @param array $conditions SQL conditions array, or type of find operation (all / first / count / - * neighbors / list / threaded) + * neighbors / list / threaded) * @param mixed $fields Either a single string of a field name, or an array of field names, or - * options for matching + * options for matching * @param string $order SQL ORDER BY conditions (e.g. "price DESC" or "name ASC") * @param integer $recursive The number of levels deep to fetch associated records * @return array Array of records