Overrides the default Query object to allow for custom soft delete filtering on queries.

package Orm
author Fuel Development Team

 Methods

Does the work for having() and or_having()

_having(array $condition, string $type) : \Orm\Query_Soft
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

\FuelException

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_Soft
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_Soft
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

\FuelException

Returns

Close a nested and_where condition

and_having_close() : \Orm\Query_Soft
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_Soft
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_Soft
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_Soft
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

$query

\Fuel\Core\Database_Query_Builder_Where

DB where() query object

$columns

array

Optionally

$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

arraywith 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

Make sure the soft-filter is added to count() calls

count(bool $column, bool $distinct) : mixed

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

mixednumber of rows OR false

Run DELETE with the current values

delete() : bool
Inherited

inherited_from \Orm\Query::delete()

Returns

boolsuccess 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

\Orm\Querynewly created instance

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

Make sure the soft-filter is added to get() calls

get() : array

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_Soft
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_Soft
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_Soft
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_Soft
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
Inherited

inherited_from \Orm\Query::hydrate()

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

boolintLast inserted ID (if present) or false on failure

Set the limit

limit(int $limit) : \Orm\Query_Soft
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

Make sure the soft-filter is added to max() calls

max(string $column) : bool | int

Parameters

$column

string

Column

Returns

boolintmaximum value OR false

Make sure the soft-filter is added to min() calls

min(string $column) : bool | int

Parameters

$column

string

Column which min value you want to get

Returns

boolintminimum value OR false

Set the offset

offset(int $offset) : \Orm\Query_Soft
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_Soft
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_Soft
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_Soft
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_Soft
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_Soft
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_Soft
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_Soft
Inherited

inherited_from \Orm\Query::order_by()
fluent This method is part of a fluent interface and will return the same instance

Parameters

$property

stringarray

$direction

string

Returns

Set the limit of rows requested

rows_limit(int $limit) : \Orm\Query_Soft
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_Soft
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

voidarray

Set any properties for insert or update

set(string | array $property, mixed $value) : \Orm\Query_Soft
Inherited

inherited_from \Orm\Query::set()
fluent This method is part of a fluent interface and will return the same instance

Parameters

$property

stringarray

$value

mixed

Optionally

Returns

Enables filtering by setting the column name to filter on.

set_soft_filter(\Orm\$col_name $col_name) : \Orm\Query_Soft

fluent This method is part of a fluent interface and will return the same instance

Parameters

$col_name

\Orm\$col_name

string

Returns

Run UPDATE with the current values

update() : bool
Inherited

inherited_from \Orm\Query::update()

Returns

boolsuccess 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

\OutOfBoundsException Cannot use undefined database view, must be defined with Model

Returns

Set where condition

where() : \Orm\Query_Soft
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_Soft
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_Soft
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()

Add an additional where clause if needed to execute the soft-filter

add_soft_filter() 

Allows subclasses to make changes to the join information before it is used

modify_join_result($join_result, $name) 

Parameters

$join_result

$name

 Properties

 

<p>Name of the filter column or null for no filtering</p>

$_col_name : null | string

 

<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
 

<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