lithium\data\Model::query()
Gets or sets the default query for the model.
Parameters
-
array
$queryPossible options are:
'conditions': The conditional query elements, e.g.'conditions' => ['published' => true]'fields': The fields that should be retrieved. When set tonull, defaults to all fields.'order': The order in which the data will be returned, e.g.'order' => 'ASC'.'limit': The maximum number of records to return.'page': For pagination of data.'with': An array of relationship names to be included in the query.
Returns
mixedReturns the query definition if querying, or null if setting.
Source
public static function query($query = null) {
$self = static::object();
if (!$query) {
return $self->_query;
}
$self->_query = $query + $self->_query;
}