Documentation

SelectStatement extends Query
in package

Represents the SELECT query

Table of Contents

Properties

$ctes  : mixed
$entityManager  : mixed
$from  : mixed
$groups  : mixed
$having  : mixed
$joins  : mixed
$limit  : mixed
$offset  : mixed
$orders  : mixed
$precedence  : mixed
$selects  : mixed
$type  : Type|null
$where  : mixed

Methods

__construct()  : mixed
Construct a SELECT query for a given table
accept()  : mixed
Visit the current Node
as()  : AliasOperator
Construct an alias for the current node
asc()  : AscOperator
Construct an ascending order for the current node
caseWhen()  : WhenNode
Construct a CASE WHEN expression (without value)
cast()  : Cast
Cast the current node to a given type
coalesce()  : mixed
crossJoin()  : SelectStatement
create a copy the statement with a new CROSS JOIN clause
desc()  : DescOperator
Construct a descending order for the current node
eq()  : EqualityOperator|IsNullOperator
Construct a '=' boolean expression
false()  : EqualityOperator|IsNullOperator
Construct a Node corresponding to a non tautology
firstValue()  : mixed
Construct a FIRST_VALUE function from the current node
fullJoin()  : SelectStatement
create a copy the statement with a new FULL JOIN clause
getCtes()  : array<string|int, mixed>
Getter for the CTEs list
getFrom()  : array<string|int, mixed>
Getter for the FROM clause table
getGroups()  : array<string|int, mixed>
Getter for the GROUP BY clause list
getHaving()  : array<string|int, mixed>
Getter for the HAVING clause predicate
getJoins()  : array<string|int, mixed>
Getter for the JOIN clause list
getLimit()  : mixed
Getter for the LIMIT clause value
getOffset()  : mixed
Getter for the OFFSET clause value
getOrders()  : array<string|int, mixed>
Getter for the ORDER BY clause list
getPrecedence()  : int
getSelects()  : array<string|int, mixed>
Getter for the SELECT clause list
getType()  : Type|null
Get the type of the Node
getWhere()  : array<string|int, mixed>
Getter for the WHERE clause predicate
group()  : SelectStatement
create a copy a the statement with expressions added to the GROUP BY clause
grouping()  : Grouping
Construct a Grouping node
having()  : SelectStatement
create a copy a the statement with more condition in the HAVING clause
in()  : InOperator|NotInOperator
Construct a 'IN' boolean expression
innerJoin()  : SelectStatement
create a copy the statement with a new INNER JOIN clause
join()  : SelectStatement
create a copy a the statement with a new JOIN clause
json()  : mixed
lastValue()  : mixed
Construct a LAST_VALUE function from the current node
leftJoin()  : SelectStatement
create a copy the statement with a new LEFT JOIN clause
limit()  : SelectStatement
Screate a copy a the statement with another LIMIT value
neq()  : NotEqualityOperator|IsNotNullOperator
Construct a '!=' boolean expression
nodeArray()  : array<string|int, mixed>
transform any object into a array of Node
notIn()  : NotInOperator|InOperator
Construct a 'NOT IN' boolean expression
of()  : Literal|Node
Transform any object into a Node (does nothing on a Node)
offset()  : SelectStatement
Screate a copy a the statement with another OFFSET value
order()  : SelectStatement
create a copy a the statement with expressions added to the ORDER BY clause
repeat()  : Repeat
Repeat the current node $times times
rightJoin()  : SelectStatement
create a copy the statement with a new RIGHT JOIN clause
select()  : SelectStatement
create a copy a the statement with expressions added to the SELECT clause
setType()  : void
Set the type of the Node
standardizeArray()  : array<string|int, mixed>
Transform any object into a array
table()  : Table
Construct a Table node
toDeleteStatement()  : DeleteStatement
Construct a DELETE statement from the current SELECT statement (see DeleteStatement constructor)
toSql()  : mixed
transform the node into a SQL query string
toUpdateStatement()  : UpdateStatement
Construt an UPDATE statement from the current SELECT statement (see UpdateStatement constructor)
true()  : EqualityOperator|IsNullOperator
Construct a Node corresponding to a tautology
tuple()  : ExpressionList
Construct a Tuple node
typed()  : Node
Set the type of the Node and return the Node
union()  : Union
Union the current query with another one
when()  : WhenNode
Construct a CASE expression from the current node and define the first WHEN clause with a given condition
where()  : SelectStatement
create a copy a the statement with more condition in the WHERE clause
with()  : SelectStatement
Add a CTE to the query

Properties

$precedence

private static mixed $precedence = [[\PhpParser\Node\Expr\Cast::class, \FND\QueryBuilder\Nodes\FunctionCall::class, \FND\QueryBuilder\Nodes\Literal::class], [\FND\QueryBuilder\Nodes\ExpressionList::class], [\FND\QueryBuilder\Nodes\Column::class], [\FND\QueryBuilder\Nodes\BinaryOperators\MulOperator::class, \FND\QueryBuilder\Nodes\BinaryOperators\DivOperator::class], [\FND\QueryBuilder\Nodes\BinaryOperators\AddOperator::class, \FND\QueryBuilder\Nodes\BinaryOperators\SubOperator::class], [\FND\QueryBuilder\Nodes\UnaryOperators\IsNullOperator::class, \FND\QueryBuilder\Nodes\UnaryOperators\IsNotNullOperator::class], [\FND\QueryBuilder\Nodes\BinaryOperators\InOperator::class, \FND\QueryBuilder\Nodes\BinaryOperators\NotInOperator::class], [\FND\QueryBuilder\Nodes\BinaryOperators\MatchOperator::class], [\FND\QueryBuilder\Nodes\BinaryOperators\LesserOrEqualOperator::class, \FND\QueryBuilder\Nodes\BinaryOperators\LesserThanOperator::class, \FND\QueryBuilder\Nodes\BinaryOperators\GreaterOrEqualOperator::class, \FND\QueryBuilder\Nodes\BinaryOperators\GreaterThanOperator::class], [\FND\QueryBuilder\Nodes\BinaryOperators\EqualityOperator::class, \FND\QueryBuilder\Nodes\BinaryOperators\NotEqualityOperator::class], [\FND\QueryBuilder\Nodes\NotOperator::class], [\FND\QueryBuilder\Nodes\BinaryOperators\AndOperator::class], [\FND\QueryBuilder\Nodes\BinaryOperators\OrOperator::class], [\FND\QueryBuilder\Nodes\BinaryOperators\AliasOperator::class]]

Methods

__construct()

Construct a SELECT query for a given table

public __construct(string|Table $from[, mixed $entityManager = NULL ]) : mixed
Parameters
$from : string|Table

a table of a table name

$entityManager : mixed = NULL

the entity manager for which the query will be executed

accept()

Visit the current Node

public accept(mixed $visitor) : mixed
Parameters
$visitor : mixed

a visitor

Return values
mixed

the result string of the visit

caseWhen()

Construct a CASE WHEN expression (without value)

public static caseWhen(mixed $condition) : WhenNode
Parameters
$condition : mixed

the first WHEN clause condition

Return values
WhenNode

the CASE WHEN expression

cast()

Cast the current node to a given type

public cast(Type $type) : Cast
Parameters
$type : Type

the type to cast to

Return values
Cast

the cast node

coalesce()

public coalesce(mixed $args) : mixed
Parameters
$args : mixed

crossJoin()

create a copy the statement with a new CROSS JOIN clause

public crossJoin(mixed $table) : SelectStatement
Parameters
$table : mixed

the table of the JOIN clause

Return values
SelectStatement

the new SELECT statement

firstValue()

Construct a FIRST_VALUE function from the current node

public firstValue([mixed $groups = [] ][, mixed $orders = [] ][, mixed $rows = [] ][, mixed $nullsDirective = 0 ]) : mixed
Parameters
$groups : mixed = []

values to partitioned by (for window functions)

$orders : mixed = []

values to order with (for window functions)

$rows : mixed = []

values to bound with (for window functions)

$nullsDirective : mixed = 0

fullJoin()

create a copy the statement with a new FULL JOIN clause

public fullJoin(mixed $table[, mixed $predicate = NULL ]) : SelectStatement
Parameters
$table : mixed

the table of the JOIN clause

$predicate : mixed = NULL

the condition to join on

Return values
SelectStatement

the new SELECT statement

getCtes()

Getter for the CTEs list

public getCtes() : array<string|int, mixed>
Return values
array<string|int, mixed>

the CTEs list

getFrom()

Getter for the FROM clause table

public getFrom() : array<string|int, mixed>
Return values
array<string|int, mixed>

the FROM clause table

getGroups()

Getter for the GROUP BY clause list

public getGroups() : array<string|int, mixed>
Return values
array<string|int, mixed>

the GROUP BY clause list

getHaving()

Getter for the HAVING clause predicate

public getHaving() : array<string|int, mixed>
Return values
array<string|int, mixed>

the HAVING clause predicate

getJoins()

Getter for the JOIN clause list

public getJoins() : array<string|int, mixed>
Return values
array<string|int, mixed>

the JOIN clause list

getLimit()

Getter for the LIMIT clause value

public getLimit() : mixed
Return values
mixed

the LIMIT clause value

getOffset()

Getter for the OFFSET clause value

public getOffset() : mixed
Return values
mixed

the OFFSET clause value

getOrders()

Getter for the ORDER BY clause list

public getOrders() : array<string|int, mixed>
Return values
array<string|int, mixed>

the ORDER BY clause list

getPrecedence()

public getPrecedence() : int
Return values
int

getSelects()

Getter for the SELECT clause list

public getSelects() : array<string|int, mixed>
Return values
array<string|int, mixed>

the SELECT clause list

getType()

Get the type of the Node

public getType() : Type|null
Return values
Type|null

the type

getWhere()

Getter for the WHERE clause predicate

public getWhere() : array<string|int, mixed>
Return values
array<string|int, mixed>

the WHERE clause predicate

group()

create a copy a the statement with expressions added to the GROUP BY clause

public group(mixed $columns) : SelectStatement
Parameters
$columns : mixed

an expression or a list of expression

Return values
SelectStatement

the new SELECT statement

grouping()

Construct a Grouping node

public static grouping(mixed $node) : Grouping
Parameters
$node : mixed

a node

Return values
Grouping

the new Grouping node

having()

create a copy a the statement with more condition in the HAVING clause

public having(mixed $predicate) : SelectStatement
Parameters
$predicate : mixed

the condition to add

Return values
SelectStatement

the new SELECT statement

innerJoin()

create a copy the statement with a new INNER JOIN clause

public innerJoin(mixed $table[, mixed $predicate = NULL ]) : SelectStatement
Parameters
$table : mixed

the table of the JOIN clause

$predicate : mixed = NULL

the condition to join on

Return values
SelectStatement

the new SELECT statement

join()

create a copy a the statement with a new JOIN clause

public join(mixed $table[, mixed $predicate = NULL ][, mixed $kind = 'INNER' ]) : SelectStatement
Parameters
$table : mixed

the table of the JOIN clause

$predicate : mixed = NULL

the condition to join on

$kind : mixed = 'INNER'

the kind of the JOIN clause

Return values
SelectStatement

the new SELECT statement

lastValue()

Construct a LAST_VALUE function from the current node

public lastValue([mixed $groups = [] ][, mixed $orders = [] ][, mixed $rows = [] ][, mixed $nullsDirective = 0 ]) : mixed
Parameters
$groups : mixed = []

values to partitioned by (for window functions)

$orders : mixed = []

values to order with (for window functions)

$rows : mixed = []

values to bound with (for window functions)

$nullsDirective : mixed = 0

leftJoin()

create a copy the statement with a new LEFT JOIN clause

public leftJoin(mixed $table[, mixed $predicate = NULL ]) : SelectStatement
Parameters
$table : mixed

the table of the JOIN clause

$predicate : mixed = NULL

the condition to join on

Return values
SelectStatement

the new SELECT statement

nodeArray()

transform any object into a array of Node

public static nodeArray(mixed $args) : array<string|int, mixed>
Parameters
$args : mixed

any object

Return values
array<string|int, mixed>

an array of Node

of()

Transform any object into a Node (does nothing on a Node)

public static of(mixed $value) : Literal|Node
Parameters
$value : mixed

any value

Return values
Literal|Node

a Node

order()

create a copy a the statement with expressions added to the ORDER BY clause

public order(mixed $columns) : SelectStatement
Parameters
$columns : mixed

an expression or a list of expression

Return values
SelectStatement

the new SELECT statement

repeat()

Repeat the current node $times times

public repeat(mixed $times) : Repeat
Parameters
$times : mixed

the number of times to repeat the current node

Return values
Repeat

the repeated node

rightJoin()

create a copy the statement with a new RIGHT JOIN clause

public rightJoin(mixed $table[, mixed $predicate = NULL ]) : SelectStatement
Parameters
$table : mixed

the table of the JOIN clause

$predicate : mixed = NULL

the condition to join on

Return values
SelectStatement

the new SELECT statement

select()

create a copy a the statement with expressions added to the SELECT clause

public select([mixed $columns = [] ]) : SelectStatement
Parameters
$columns : mixed = []

an expression or a list of expression

Return values
SelectStatement

the new SELECT statement

setType()

Set the type of the Node

public setType(Type $type) : void
Parameters
$type : Type

the type

standardizeArray()

Transform any object into a array

public static standardizeArray(mixed $args) : array<string|int, mixed>
Parameters
$args : mixed

the object

Return values
array<string|int, mixed>

the array

table()

Construct a Table node

public static table(mixed $name) : Table
Parameters
$name : mixed

the table name

Return values
Table

the table

toDeleteStatement()

Construct a DELETE statement from the current SELECT statement (see DeleteStatement constructor)

public toDeleteStatement() : DeleteStatement
Return values
DeleteStatement

the new DELETE statement

toSql()

transform the node into a SQL query string

public toSql([mixed $connection = NULL ]) : mixed
Parameters
$connection : mixed = NULL

the DB connection concerned (to select the right visitor)

Return values
mixed

the SQL string

toUpdateStatement()

Construt an UPDATE statement from the current SELECT statement (see UpdateStatement constructor)

public toUpdateStatement(mixed $values) : UpdateStatement
Parameters
$values : mixed

an associated array where the key à the column name and the values are expression Node

Return values
UpdateStatement

the new UPDATE statement

tuple()

Construct a Tuple node

public static tuple(mixed $array) : ExpressionList
Parameters
$array : mixed

a list

Return values
ExpressionList

the new Tuple node

typed()

Set the type of the Node and return the Node

public typed(Type $type) : Node
Parameters
$type : Type

the type

Return values
Node

the current Node

union()

Union the current query with another one

public union(mixed $query[, mixed $all = false ]) : Union
Parameters
$query : mixed

mixed

$all : mixed = false

boolean

Return values
Union

the union node

when()

Construct a CASE expression from the current node and define the first WHEN clause with a given condition

public when(mixed $condition) : WhenNode
Parameters
$condition : mixed
Return values
WhenNode

the case node

where()

create a copy a the statement with more condition in the WHERE clause

public where(mixed $predicate) : SelectStatement
Parameters
$predicate : mixed

the condition to add

Return values
SelectStatement

the new SELECT statement

with()

Add a CTE to the query

public with(mixed $name, mixed $query) : SelectStatement
Parameters
$name : mixed

the name of the CTE

$query : mixed

the query of the CTE

Return values
SelectStatement

the new SELECT statement


        
On this page

Search results