lithium\data\Model::query PHP Method

query() public static method

Gets or sets the default query for the model.
public static query ( array $query = null ) : mixed
$query array Possible options are: - `'conditions'`: The conditional query elements, e.g. `'conditions' => array('published' => true)` - `'fields'`: The fields that should be retrieved. When set to `null`, 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.
return mixed Returns the query definition if querying, or `null` if setting.
    public static function query($query = null)
    {
        $self = static::_object();
        if (!$query) {
            return $self->_query;
        }
        $self->_query += $query;
    }