Adds temporal properties to the query object to allow for correct relation
filtering on joins.
Methods
Does the work for having() and or_having()
_having(array $condition, string $type) : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::_having() |
fluent |
This method is part of a fluent interface and will return the same instance |
Parameters
$condition
array
$type
string
Exceptions
Returns
Load the ORM config file
_init()
Inherited
inherited_from |
\Orm\Query::_init() |
Add a table to join, consider this a protect method only for Orm package usage
_join(array $join) : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::_join() |
fluent |
This method is part of a fluent interface and will return the same instance |
Parameters
$join
array
Returns
Parses an array of where conditions into the query
_parse_where_array(array $val, string $base, bool $or)
Inherited
inherited_from |
\Orm\Query::_parse_where_array() |
Parameters
$val
array
$base
string
$or
bool
Does the work for where() and or_where()
_where(array $condition, string $type) : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::_where() |
fluent |
This method is part of a fluent interface and will return the same instance |
Parameters
$condition
array
$type
string
Exceptions
Returns
Close a nested and_where condition
and_having_close() : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::and_having_close() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Open a nested and_having condition
and_having_open() : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::and_having_open() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Close a nested and_where condition
and_where_close() : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::and_where_close() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Open a nested and_where condition
and_where_open() : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::and_where_open() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Build a select, delete or update query
build_query(\Fuel\Core\Database_Query_Builder_Where $query, array $columns, string $type) : array
Inherited
inherited_from |
\Orm\Query::build_query() |
Parameters
$type
string
Type of query to build (count/select/update/delete/insert)
Exceptions
\FuelException |
Models cannot be related between different database connections |
\UnexpectedValueException |
Trying to get the relation of an unloaded relation |
Returns
array
with keys query and relations
Enables or disables the default state of the object cache
caching(bool $cache) : \Orm\Query
Inherited
inherited_from |
\Orm\Query::caching() |
Parameters
$cache
bool
Whether or not to use the object cache by default
Returns
Sets the name of the connection to use for this query.
connection(string $name)
Inherited
Set to null to use the default DB connection
inherited_from |
\Orm\Query::connection() |
Parameters
$name
string
Count the result of a query
count(bool $column, bool $distinct) : mixed
Inherited
inherited_from |
\Orm\Query::count() |
Parameters
$column
bool
False for random selected column or specific column, only works for main model currently
$distinct
bool
True if DISTINCT has to be aded to the query
Returns
mixed
number of rows OR false
Run DELETE with the current values
delete() : bool
Inherited
inherited_from |
\Orm\Query::delete() |
Returns
bool
success of delete operation
Create a new instance of the Query class.
forge(string $model, mixed $connection, array $options) : \Orm\Query
Inherited
inherited_from |
\Orm\Query::forge() |
Parameters
$model
string
name of the model this instance has to operate on
$connection
mixed
DB connection to use to run the query
$options
array
any options to pass on to the query
Returns
Enables or disables the object cache for this query
from_cache(bool $cache) : \Orm\Query
Inherited
inherited_from |
\Orm\Query::from_cache() |
Parameters
$cache
bool
Whether or not to use the object cache on this query
Returns
Build the query and return hydrated results
get() : array
Inherited
inherited_from |
\Orm\Query::get() |
Returns
array
Build the query and return single object hydrated
get_one() : \Orm\Model
Inherited
inherited_from |
\Orm\Query::get_one() |
Returns
Get the Query as it's been build up to this point and return it as an object
get_query() : \Orm\Database_Query
Inherited
inherited_from |
\Orm\Query::get_query() |
Returns
\Orm\Database_Query
Creates a "GROUP BY .
group_by() : \Orm\Query_Temporal
Inherited
.." filter.
inherited_from |
\Orm\Query::group_by() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Set having condition
having() : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::having() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Alias to and_having_close()
having_close() : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::having_close() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Alias to and_having_open()
having_open() : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::having_open() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Hydrate model instances with retrieved data
hydrate(array $row, array $models, \stdClass $result, string $model, array $select, array $primary_key) : \Orm\Model
Parameters
$row
array
&$row Row from the database
$models
array
Relations to be expected
$result
\stdClass
An object containing current result array
$model
string
Optionally. Model classname to hydrate
$select
array
Optionally. Columns to use
$primary_key
array
Optionally. Primary key(s) for this model
Returns
Run INSERT with the current values
insert() : bool | int
Inherited
inherited_from |
\Orm\Query::insert() |
Returns
bool
int
Last inserted ID (if present) or false on failure
Set the limit
limit(int $limit) : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::limit() |
fluent |
This method is part of a fluent interface and will return the same instance |
Parameters
$limit
int
Returns
Get the maximum of a column for the current query
max(string $column) : bool | int
Inherited
inherited_from |
\Orm\Query::max() |
Parameters
Returns
bool
int
maximum value OR false
Get the minimum of a column for the current query
min(string $column) : bool | int
Inherited
inherited_from |
\Orm\Query::min() |
Parameters
$column
string
Column which min value you want to get
Returns
bool
int
minimum value OR false
Set the offset
offset(int $offset) : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::offset() |
fluent |
This method is part of a fluent interface and will return the same instance |
Parameters
$offset
int
Returns
Set or_having condition
or_having() : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::or_having() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Close a nested or_where condition
or_having_close() : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::or_having_close() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Open a nested or_having condition
or_having_open() : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::or_having_open() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Set or_where condition
or_where() : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::or_where() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Close a nested or_where condition
or_where_close() : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::or_where_close() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Open a nested or_where condition
or_where_open() : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::or_where_open() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Set the order_by
order_by(string | array $property, string $direction) : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::order_by() |
fluent |
This method is part of a fluent interface and will return the same instance |
Parameters
$property
string
array
$direction
string
Returns
Set the limit of rows requested
rows_limit(int $limit) : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::rows_limit() |
fluent |
This method is part of a fluent interface and will return the same instance |
Parameters
$limit
int
Returns
Set the offset of rows requested
rows_offset(int $offset) : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::rows_offset() |
fluent |
This method is part of a fluent interface and will return the same instance |
Parameters
$offset
int
Returns
Select which properties are included, each as its own param.
select(bool $add_pks) : void | array
Inherited
Or don't give input to retrieve
the current selection.
inherited_from |
\Orm\Query::select() |
Parameters
$add_pks
bool
Whether or not to add the Primary Keys to the list of selected columns
Exceptions
\FuelException |
No properties found in model |
Returns
void
array
Set any properties for insert or update
set(string | array $property, mixed $value) : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::set() |
fluent |
This method is part of a fluent interface and will return the same instance |
Parameters
$property
string
array
Returns
Sets the timestamp to be used on joins.
set_temporal_properties(string $stamp, string $timestamp_end_col, string $timestamp_start_col)
If set to null the latest revision
is used.
Parameters
$stamp
string
Timestamp to look for
$timestamp_end_col
string
Name of the end timestamp column
$timestamp_start_col
string
Name of teh start timestamp column
Run UPDATE with the current values
update() : bool
Inherited
inherited_from |
\Orm\Query::update() |
Returns
bool
success of update operation
Determines whether a subquery is needed, is the case if there was a limit/offset on a join
use_subquery() : bool
Inherited
inherited_from |
\Orm\Query::use_subquery() |
Returns
bool
Set a view to use instead of the table
use_view(string $view) : \Orm\Query
Inherited
inherited_from |
\Orm\Query::use_view() |
Parameters
$view
string
Name of view which you want to use
Exceptions
Returns
Set where condition
where() : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::where() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Alias to and_where_close()
where_close() : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::where_close() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Alias to and_where_open()
where_open() : \Orm\Query_Temporal
Inherited
inherited_from |
\Orm\Query::where_open() |
fluent |
This method is part of a fluent interface and will return the same instance |
Returns
Create a new instance of the Query class.
__construct(string $model, mixed $connection, array $options, mixed $table_alias)
Inherited
inherited_from |
\Orm\Query::__construct() |
Parameters
$model
string
Name of the model this instance has to operate on
$connection
mixed
DB connection to use to run the query
$options
array
Any options to pass on to the query
$table_alias
mixed
Optionally, the alias to use for the models table
/* normalize the select fields passed
_normalize(array $fields, int $i)
Inherited
inherited_from |
\Orm\Query::_normalize() |
Parameters
$fields
array
list of columns to select
$i
int
counter of the number of selected columnss
Returns target table (or view, if specified).
_table()
Inherited
inherited_from |
\Orm\Query::_table() |
Adds extra where conditions when temporal filtering is needed.
modify_join_result(array $join_result, string $name) : array
Parameters
$join_result
array
$name
string
Returns
array
Properties
<p>table alias</p>
$alias : string
Inherited
inherited_from |
\Orm\Query::$$alias |
<p>switch to globally enable/disable object caching</p>
$caching : bool
Inherited
inherited_from |
\Orm\Query::$$caching |
<p>connection name to use</p>
$connection : null | string
Inherited
inherited_from |
\Orm\Query::$$connection |
<p>whether or not to retrieve a cached object</p>
$from_cache : bool
Inherited
inherited_from |
\Orm\Query::$$from_cache |
<p>group by clauses</p>
$group_by : array
Inherited
inherited_from |
\Orm\Query::$$group_by |
<p>having clauses</p>
$having : array
Inherited
inherited_from |
\Orm\Query::$$having |
<p>tables to join without returning any info</p>
$joins : array
Inherited
inherited_from |
\Orm\Query::$$joins |
<p>max number of returned base model instances</p>
$limit : int
Inherited
inherited_from |
\Orm\Query::$$limit |
<p>classname of the model</p>
$model : string
Inherited
inherited_from |
\Orm\Query::$$model |
<p>offset of base model table</p>
$offset : int
Inherited
inherited_from |
\Orm\Query::$$offset |
<p>order by clauses</p>
$order_by : array
Inherited
inherited_from |
\Orm\Query::$$order_by |
<p>relations to join on</p>
$relations : array
Inherited
inherited_from |
\Orm\Query::$$relations |
<p>max number of requested rows</p>
$rows_limit : int
Inherited
inherited_from |
\Orm\Query::$$rows_limit |
<p>offset of requested rows</p>
$rows_offset : int
Inherited
inherited_from |
\Orm\Query::$$rows_offset |
<p>fields to select</p>
$select : array
Inherited
inherited_from |
\Orm\Query::$$select |
<p>select filters</p>
$select_filter : array
Inherited
inherited_from |
\Orm\Query::$$select_filter |
$timestamp_end_col
$timestamp_end_col
$timestamp_start_col
$timestamp_start_col
<p>values for insert or update</p>
$values : array
Inherited
inherited_from |
\Orm\Query::$$values |
<p>database view to use with keys 'view' and 'columns'</p>
$view : array
Inherited
inherited_from |
\Orm\Query::$$view |
<p>where conditions</p>
$where : array
Inherited
inherited_from |
\Orm\Query::$$where |
<p>connection name to use for writes</p>
$write_connection : null | string
Inherited
inherited_from |
\Orm\Query::$$write_connection |