PHP Interface ManaPHP\Mvc\Model\QueryBuilderInterface

Show file Open project: manaphp/manaphp Interface Usage Examples

Public Methods

Method Description
addFrom ( string | ManaPHP\Mvc\Model\QueryBuilderInterface $model, string $alias = null ) : static Add a model to take part of the query
andWhere ( string $conditions, integer | float | string | array $bind = [] ) : static Appends a condition to the current conditions using a AND operator
betweenWhere ( string $expr, integer | float $min, integer | float $max ) : static Appends a BETWEEN condition to the current conditions
columns ( string $columns ) : static Sets the columns to be queried
distinct ( boolean $distinct ) : static Sets the columns to be queried
execute ( integer | array $cacheOptions = null ) : array build the query and execute it.
executeEx ( integer | string &$totalRows, integer | array $cacheOptions = null ) : array build the query and execute it.
forUpdate ( boolean $forUpdate = true ) : static Sets a FOR UPDATE clause
from ( string | array $models ) : static Sets the models who makes part of the query
getBind ( ) : array
getSql ( ) : string Returns a SQL statement built based on the builder parameters
groupBy ( string $group ) : static Sets a LIMIT clause
having ( string $having, array $bind = null ) : static Sets a HAVING condition clause
inWhere ( string $expr, array | ManaPHP\Mvc\Model\QueryBuilderInterface $values ) : static Appends an IN condition to the current conditions
innerJoin ( string | ManaPHP\Mvc\Model\QueryBuilderInterface $model, string $conditions = null, string $alias = null ) : static Adds a INNER join to the query
join ( string | ManaPHP\Mvc\Model\QueryBuilderInterface $model, string $conditions = null, string $alias = null, string $type = null ) : static Adds a INNER join to the query
leftJoin ( string | ManaPHP\Mvc\Model\QueryBuilderInterface $model, string $conditions = null, string $alias = null ) : static Adds a LEFT join to the query
limit ( integer $limit, integer $offset ) : static Sets a LIMIT clause
notBetweenWhere ( string $expr, integer | float $min, integer | float $max ) : static Appends a NOT BETWEEN condition to the current conditions
notInWhere ( string $expr, array | ManaPHP\Mvc\Model\QueryBuilderInterface $values ) : static Appends a NOT IN condition to the current conditions
orderBy ( string $orderBy ) : static Sets a ORDER BY condition clause
page ( integer $size, integer $current = 1 ) : static
paginate ( integer $size, integer $page, integer | array $cacheOptions = null ) : static
rightJoin ( string | ManaPHP\Mvc\Model\QueryBuilderInterface $model, string $conditions = null, string $alias = null ) : static Adds a RIGHT join to the query
setBind ( array $bind, boolean $merge = true ) : static Set default bind parameters
unionAll ( ManaPHP\Mvc\Model\QueryBuilderInterface[] $builders ) : static
unionDistinct ( ManaPHP\Mvc\Model\QueryBuilderInterface[] $builders ) : static
where ( string $conditions, integer | float | string | array $bind = [] ) : static Sets conditions for the query

Method Details

addFrom() public method

Add a model to take part of the query
public addFrom ( string | ManaPHP\Mvc\Model\QueryBuilderInterface $model, string $alias = null ) : static
$model string | ManaPHP\Mvc\Model\QueryBuilderInterface
$alias string
return static

andWhere() public method

Appends a condition to the current conditions using a AND operator
public andWhere ( string $conditions, integer | float | string | array $bind = [] ) : static
$conditions string
$bind integer | float | string | array
return static

betweenWhere() public method

Appends a BETWEEN condition to the current conditions
public betweenWhere ( string $expr, integer | float $min, integer | float $max ) : static
$expr string
$min integer | float
$max integer | float
return static

columns() public method

Sets the columns to be queried
public columns ( string $columns ) : static
$columns string
return static

distinct() public method

Sets the columns to be queried
public distinct ( boolean $distinct ) : static
$distinct boolean
return static

execute() public method

build the query and execute it.
public execute ( integer | array $cacheOptions = null ) : array
$cacheOptions integer | array
return array

executeEx() public method

build the query and execute it.
public executeEx ( integer | string &$totalRows, integer | array $cacheOptions = null ) : array
$totalRows integer | string
$cacheOptions integer | array
return array

forUpdate() public method

$builder->forUpdate(true);
public forUpdate ( boolean $forUpdate = true ) : static
$forUpdate boolean
return static

from() public method

Sets the models who makes part of the query
public from ( string | array $models ) : static
$models string | array
return static

getBind() public method

public getBind ( ) : array
return array

getSql() public method

Returns a SQL statement built based on the builder parameters
public getSql ( ) : string
return string

groupBy() public method

Sets a LIMIT clause
public groupBy ( string $group ) : static
$group string
return static

having() public method

Sets a HAVING condition clause
public having ( string $having, array $bind = null ) : static
$having string
$bind array
return static

inWhere() public method

Appends an IN condition to the current conditions
public inWhere ( string $expr, array | ManaPHP\Mvc\Model\QueryBuilderInterface $values ) : static
$expr string
$values array | ManaPHP\Mvc\Model\QueryBuilderInterface
return static

innerJoin() public method

Adds a INNER join to the query
public innerJoin ( string | ManaPHP\Mvc\Model\QueryBuilderInterface $model, string $conditions = null, string $alias = null ) : static
$model string | ManaPHP\Mvc\Model\QueryBuilderInterface
$conditions string
$alias string
return static

join() public method

Adds a INNER join to the query
public join ( string | ManaPHP\Mvc\Model\QueryBuilderInterface $model, string $conditions = null, string $alias = null, string $type = null ) : static
$model string | ManaPHP\Mvc\Model\QueryBuilderInterface
$conditions string
$alias string
$type string
return static

leftJoin() public method

Adds a LEFT join to the query
public leftJoin ( string | ManaPHP\Mvc\Model\QueryBuilderInterface $model, string $conditions = null, string $alias = null ) : static
$model string | ManaPHP\Mvc\Model\QueryBuilderInterface
$conditions string
$alias string
return static

limit() public method

Sets a LIMIT clause
public limit ( integer $limit, integer $offset ) : static
$limit integer
$offset integer
return static

notBetweenWhere() public method

$builder->notBetweenWhere('price', 100.25, 200.50);
public notBetweenWhere ( string $expr, integer | float $min, integer | float $max ) : static
$expr string
$min integer | float
$max integer | float
return static

notInWhere() public method

Appends a NOT IN condition to the current conditions
public notInWhere ( string $expr, array | ManaPHP\Mvc\Model\QueryBuilderInterface $values ) : static
$expr string
$values array | ManaPHP\Mvc\Model\QueryBuilderInterface
return static

orderBy() public method

Sets a ORDER BY condition clause
public orderBy ( string $orderBy ) : static
$orderBy string
return static

page() public method

public page ( integer $size, integer $current = 1 ) : static
$size integer
$current integer
return static

paginate() public method

public paginate ( integer $size, integer $page, integer | array $cacheOptions = null ) : static
$size integer
$page integer
$cacheOptions integer | array
return static

rightJoin() public method

Adds a RIGHT join to the query
public rightJoin ( string | ManaPHP\Mvc\Model\QueryBuilderInterface $model, string $conditions = null, string $alias = null ) : static
$model string | ManaPHP\Mvc\Model\QueryBuilderInterface
$conditions string
$alias string
return static

setBind() public method

Set default bind parameters
public setBind ( array $bind, boolean $merge = true ) : static
$bind array
$merge boolean
return static

unionAll() public method

public unionAll ( ManaPHP\Mvc\Model\QueryBuilderInterface[] $builders ) : static
$builders ManaPHP\Mvc\Model\QueryBuilderInterface[]
return static

unionDistinct() public method

public unionDistinct ( ManaPHP\Mvc\Model\QueryBuilderInterface[] $builders ) : static
$builders ManaPHP\Mvc\Model\QueryBuilderInterface[]
return static

where() public method

Sets conditions for the query
public where ( string $conditions, integer | float | string | array $bind = [] ) : static
$conditions string
$bind integer | float | string | array
return static