PHP Интерфейс ManaPHP\Mvc\Model\QueryBuilderInterface

Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
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

Описание методов

addFrom() публичный Метод

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
Результат static

andWhere() публичный Метод

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
Результат static

betweenWhere() публичный Метод

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
Результат static

columns() публичный Метод

Sets the columns to be queried
public columns ( string $columns ) : static
$columns string
Результат static

distinct() публичный Метод

Sets the columns to be queried
public distinct ( boolean $distinct ) : static
$distinct boolean
Результат static

execute() публичный Метод

build the query and execute it.
public execute ( integer | array $cacheOptions = null ) : array
$cacheOptions integer | array
Результат array

executeEx() публичный Метод

build the query and execute it.
public executeEx ( integer | string &$totalRows, integer | array $cacheOptions = null ) : array
$totalRows integer | string
$cacheOptions integer | array
Результат array

forUpdate() публичный Метод

$builder->forUpdate(true);
public forUpdate ( boolean $forUpdate = true ) : static
$forUpdate boolean
Результат static

from() публичный Метод

Sets the models who makes part of the query
public from ( string | array $models ) : static
$models string | array
Результат static

getBind() публичный Метод

public getBind ( ) : array
Результат array

getSql() публичный Метод

Returns a SQL statement built based on the builder parameters
public getSql ( ) : string
Результат string

groupBy() публичный Метод

Sets a LIMIT clause
public groupBy ( string $group ) : static
$group string
Результат static

having() публичный Метод

Sets a HAVING condition clause
public having ( string $having, array $bind = null ) : static
$having string
$bind array
Результат static

inWhere() публичный Метод

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
Результат static

innerJoin() публичный Метод

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
Результат static

join() публичный Метод

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
Результат static

leftJoin() публичный Метод

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
Результат static

limit() публичный Метод

Sets a LIMIT clause
public limit ( integer $limit, integer $offset ) : static
$limit integer
$offset integer
Результат static

notBetweenWhere() публичный Метод

$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
Результат static

notInWhere() публичный Метод

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
Результат static

orderBy() публичный Метод

Sets a ORDER BY condition clause
public orderBy ( string $orderBy ) : static
$orderBy string
Результат static

page() публичный Метод

public page ( integer $size, integer $current = 1 ) : static
$size integer
$current integer
Результат static

paginate() публичный Метод

public paginate ( integer $size, integer $page, integer | array $cacheOptions = null ) : static
$size integer
$page integer
$cacheOptions integer | array
Результат static

rightJoin() публичный Метод

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
Результат static

setBind() публичный Метод

Set default bind parameters
public setBind ( array $bind, boolean $merge = true ) : static
$bind array
$merge boolean
Результат static

unionAll() публичный Метод

public unionAll ( ManaPHP\Mvc\Model\QueryBuilderInterface[] $builders ) : static
$builders ManaPHP\Mvc\Model\QueryBuilderInterface[]
Результат static

unionDistinct() публичный Метод

public unionDistinct ( ManaPHP\Mvc\Model\QueryBuilderInterface[] $builders ) : static
$builders ManaPHP\Mvc\Model\QueryBuilderInterface[]
Результат static

where() публичный Метод

Sets conditions for the query
public where ( string $conditions, integer | float | string | array $bind = [] ) : static
$conditions string
$bind integer | float | string | array
Результат static