PHP Class Pheasant\Query\Query

Inheritance: implements IteratorAggregate, implements Countable
Show file Open project: lox/pheasant Class Usage Examples

Public Methods

Method Description
__call ( $method, $params ) Kicker methods trigger execution
__construct ( $connection = null ) Constructor
__toString ( )
andOrderBy ( $sql, $params = [] ) Convenience method for orderBy, to be consistent with where and andWhere.
andWhere ( $sql = null, $params = [] ) Adds an extra criteria to the where clause with an AND
count ( ) kicker methods execute the query
distinct ( $value = true ) Whether to prefix the SELECT clause with DISTINCT
execute ( ) : Result Executes the query with the provided connection
from ( $table ) Sets the FROM clause, either a single table, an array or varargs.
getIterator ( ) * (non-phpdoc)
groupBy ( $sql, $params = [] ) Adds an group by clause
innerJoin ( $mixed, $criteria, $alias = '' ) Adds an INNER JOIN clause, either with a {@link Query} object or raw sql
leftJoin ( $mixed, $criteria, $alias = '' ) Adds a LEFT JOIN clause, either with a {@link Query} object or raw sql
limit ( $rows, $offset ) Adds a limit clause
lock ( $clause = '' ) Adds a locking clause after the SELECT, defaults to FOR UPDATE
orWhere ( $sql = null, $params = [] ) Adds an extra criteria to the where clause with an OR
orderBy ( $sql, $params = [] ) Adds an order by clause
rightJoin ( $mixed, $criteria, $alias = '' ) Adds a RIGHT JOIN clause, either with a {@link Query} object or raw sql
select ( $column ) Sets the SELECT clause, either a single column, an array or varargs.
toSql ( ) Returns the sql for the query
where ( $sql = null, $params = [] ) Sets the where clause to the provided sql, optionally binding parameters into the string.

Private Methods

Method Description
_arguments ( $args )
_clause ( $clause, $arg, $delim = ', ' )
_join ( $type, $mixed, $criteria, $alias = '' ) private helper methods

Method Details

__call() public method

Kicker methods trigger execution
public __call ( $method, $params )

__construct() public method

Constructor
public __construct ( $connection = null )

__toString() public method

public __toString ( )

andOrderBy() public method

Convenience method for orderBy, to be consistent with where and andWhere.
public andOrderBy ( $sql, $params = [] )

andWhere() public method

Adds an extra criteria to the where clause with an AND
public andWhere ( $sql = null, $params = [] )

count() public method

kicker methods execute the query
public count ( )

distinct() public method

Whether to prefix the SELECT clause with DISTINCT
public distinct ( $value = true )

execute() public method

Executes the query with the provided connection
public execute ( ) : Result
return Result

from() public method

Sets the FROM clause, either a single table, an array or varargs.
public from ( $table )

getIterator() public method

* (non-phpdoc)
See also: IteratorAggregate
public getIterator ( )

groupBy() public method

Adds an group by clause
public groupBy ( $sql, $params = [] )

innerJoin() public method

Adds an INNER JOIN clause, either with a {@link Query} object or raw sql
public innerJoin ( $mixed, $criteria, $alias = '' )

leftJoin() public method

Adds a LEFT JOIN clause, either with a {@link Query} object or raw sql
public leftJoin ( $mixed, $criteria, $alias = '' )

limit() public method

Adds a limit clause
public limit ( $rows, $offset )

lock() public method

Adds a locking clause after the SELECT, defaults to FOR UPDATE
public lock ( $clause = '' )

orWhere() public method

Adds an extra criteria to the where clause with an OR
public orWhere ( $sql = null, $params = [] )

orderBy() public method

Adds an order by clause
public orderBy ( $sql, $params = [] )

rightJoin() public method

Adds a RIGHT JOIN clause, either with a {@link Query} object or raw sql
public rightJoin ( $mixed, $criteria, $alias = '' )

select() public method

Sets the SELECT clause, either a single column, an array or varargs.
public select ( $column )

toSql() public method

Returns the sql for the query
public toSql ( )

where() public method

Sets the where clause to the provided sql, optionally binding parameters into the string.
public where ( $sql = null, $params = [] )