PHP Class Habari\QueryWhere

See also: Query
Show file Open project: habari/system

Protected Properties

Property Type Description
$expressions
$operator
$parameters

Public Methods

Method Description
__construct ( string $operator = 'AND' ) Constructor for the QueryWhere
__get ( string $name ) : mixed Get a parameter value, class magic __get method
__set ( string $name, mixed $value ) : mixed Set a parameter value, class magic __set method
add ( string | QueryWhere $expression, array $parameters = [], string $name = null ) : QueryWhere
count ( ) : integer Get the number of expressions contained in this QueryWhere
create ( string $operator = 'AND' ) : QueryWhere Convenience function for fluid interface
exists ( Query $values, string $paramname = null, boolean $positive = true ) : QueryWhere Shortcut to implementing an EXISTS test for one or more values as a new expression
get ( integer $level ) : string Obtain the where clause as a string to use in a query
get_named ( string $name ) : null | string | QueryWhere Return the named expression from this QueryWhere
in ( $field, $values, string $paramname = null, callback $validator = null, boolean $positive = true ) : QueryWhere Shortcut to implementing an IN or equality test for one or more values as a new expression
params ( ) : array Obtain the parameters supplied for the where clause

Method Details

__construct() public method

Constructor for the QueryWhere
public __construct ( string $operator = 'AND' )
$operator string The operator (AND/OR) to user between expressions in this clause

__get() public method

Get a parameter value, class magic __get method
public __get ( string $name ) : mixed
$name string The name of the parameter to get
return mixed The value of the parameter requested

__set() public method

Set a parameter value, class magic __set method
public __set ( string $name, mixed $value ) : mixed
$name string The name of the parameter to set
$value mixed The value to set the parameter to
return mixed The supplied value

add() public method

public add ( string | QueryWhere $expression, array $parameters = [], string $name = null ) : QueryWhere
$expression string | QueryWhere A string expression to use as part of the query's where clause or a compound expression represented by an additional QueryWhere instance
$parameters array An associative array of values to use as named parameters in the added expression
$name string Name of the expression
return QueryWhere Returns $this, for fluid interface.

count() public method

Get the number of expressions contained in this QueryWhere
public count ( ) : integer
return integer Number of expressions.

create() public method

Convenience function for fluid interface
public create ( string $operator = 'AND' ) : QueryWhere
$operator string The operator (AND/OR) to user between expressions in this clause
return QueryWhere Configured instance of the QueryWhere

exists() public method

Shortcut to implementing an EXISTS test for one or more values as a new expression
public exists ( Query $values, string $paramname = null, boolean $positive = true ) : QueryWhere
$values Query
$paramname string
$positive boolean
return QueryWhere Returns $this, for fluid interface

get() public method

Obtain the where clause as a string to use in a query
public get ( integer $level ) : string
$level integer Used internally to retain indenting
return string The where clause represented by this object

get_named() public method

Return the named expression from this QueryWhere
public get_named ( string $name ) : null | string | QueryWhere
$name string The name provided for the expression
return null | string | QueryWhere The requested expression

in() public method

Shortcut to implementing an IN or equality test for one or more values as a new expression
public in ( $field, $values, string $paramname = null, callback $validator = null, boolean $positive = true ) : QueryWhere
$field
$values
$paramname string
$validator callback
$positive boolean
return QueryWhere Returns $this, for fluid interface

params() public method

Obtain the parameters supplied for the where clause
public params ( ) : array
return array An associative array of parameters added to this where clause

Property Details

$expressions protected property

protected $expressions

$operator protected property

protected $operator

$parameters protected property

protected $parameters