Aplus Framework Docs

Join

Trait Join.

Tags
see
https://mariadb.com/kb/en/joins/
todo

STRAIGHT_JOIN - https://mariadb.com/kb/en/index-hints-how-to-force-query-plans/

Table of Contents

crossJoin()  : static
Adds a JOIN clause with "CROSS JOIN $table".
crossJoinOn()  : static
Adds a JOIN clause with "CROSS JOIN $table ON $conditional".
crossJoinUsing()  : static
Adds a JOIN clause with "CROSS JOIN $table USING ...$columns".
from()  : static
Sets the FROM clause.
innerJoinOn()  : static
Adds a JOIN clause with "INNER JOIN $table ON $conditional".
innerJoinUsing()  : static
Adds a JOIN clause with "INNER JOIN $table USING ...$columns".
join()  : static
Adds a JOIN clause with "$type JOIN $table $clause $conditional".
joinOn()  : static
Adds a JOIN clause with "JOIN $table ON $conditional".
joinUsing()  : static
Adds a JOIN clause with "JOIN $table USING ...$columns".
leftJoinOn()  : static
Adds a JOIN clause with "LEFT JOIN $table ON $conditional".
leftJoinUsing()  : static
Adds a JOIN clause with "LEFT JOIN $table USING ...$columns".
leftOuterJoinOn()  : static
Adds a JOIN clause with "LEFT OUTER JOIN $table ON $conditional".
leftOuterJoinUsing()  : static
Adds a JOIN clause with "LEFT OUTER JOIN $table USING ...$columns".
naturalJoin()  : static
Adds a JOIN clause with "NATURAL JOIN $table".
naturalLeftJoin()  : static
Adds a JOIN clause with "NATURAL LEFT JOIN $table".
naturalLeftOuterJoin()  : static
Adds a JOIN clause with "NATURAL LEFT OUTER JOIN $table".
naturalRightJoin()  : static
Adds a JOIN clause with "NATURAL RIGHT JOIN $table".
naturalRightOuterJoin()  : static
Adds a JOIN clause with "NATURAL RIGHT OUTER JOIN $table".
rightJoinOn()  : static
Adds a JOIN clause with "RIGHT JOIN $table ON $conditional".
rightJoinUsing()  : static
Adds a JOIN clause with "RIGHT JOIN $table USING ...$columns".
rightOuterJoinOn()  : static
Adds a JOIN clause with "RIGHT OUTER JOIN $table ON $conditional".
rightOuterJoinUsing()  : static
Adds a JOIN clause with "RIGHT OUTER JOIN $table USING ...$columns".
hasFrom()  : bool
Tells if the FROM clause was set.
renderFrom()  : string|null
Renders the FROM clause.
renderJoin()  : string|null
Renders the JOIN clause.

Methods

crossJoin()

Adds a JOIN clause with "CROSS JOIN $table".

public crossJoin(array<string, \Closure|string>|Closure|string $table) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

Return values
static

crossJoinOn()

Adds a JOIN clause with "CROSS JOIN $table ON $conditional".

public crossJoinOn(array<string, \Closure|string>|Closure|string $table, Closure $conditional) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

$conditional : Closure

Conditional expression

Return values
static

crossJoinUsing()

Adds a JOIN clause with "CROSS JOIN $table USING ...$columns".

public crossJoinUsing(array<string, \Closure|string>|Closure|string $table, Closure|string ...$columns) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

$columns : Closure|string

Columns list

Return values
static

from()

Sets the FROM clause.

public from(array<string, \Closure|string>|Closure|string $reference, array<string, \Closure|string>|Closure|string ...$references) : static
Parameters
$reference : array<string, \Closure|string>|Closure|string

Table reference

$references : array<string, \Closure|string>|Closure|string

Table references

Tags
see
https://mariadb.com/kb/en/join-syntax/
Return values
static

innerJoinOn()

Adds a JOIN clause with "INNER JOIN $table ON $conditional".

public innerJoinOn(array<string, \Closure|string>|Closure|string $table, Closure $conditional) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

$conditional : Closure

Conditional expression

Return values
static

innerJoinUsing()

Adds a JOIN clause with "INNER JOIN $table USING ...$columns".

public innerJoinUsing(array<string, \Closure|string>|Closure|string $table, Closure|string ...$columns) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

$columns : Closure|string

Columns list

Return values
static

join()

Adds a JOIN clause with "$type JOIN $table $clause $conditional".

public join(array<string, \Closure|string>|Closure|string $table[, string $type = '' ][, string|null $clause = null ][, array<int, \Closure|string>|Closure|null $conditional = null ]) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

$type : string = ''

JOIN type. One of: CROSS, INNER, LEFT, LEFT OUTER, RIGHT, RIGHT OUTER, NATURAL, NATURAL LEFT, NATURAL LEFT OUTER, NATURAL RIGHT, NATURAL RIGHT OUTER or empty (same as INNER)

$clause : string|null = null

Condition clause. Null if it has a NATURAL type, otherwise ON or USING

$conditional : array<int, \Closure|string>|Closure|null = null

A conditional expression as Closure or the columns list as array

Return values
static

joinOn()

Adds a JOIN clause with "JOIN $table ON $conditional".

public joinOn(array<string, \Closure|string>|Closure|string $table, Closure $conditional) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

$conditional : Closure

Conditional expression

Return values
static

joinUsing()

Adds a JOIN clause with "JOIN $table USING ...$columns".

public joinUsing(array<string, \Closure|string>|Closure|string $table, Closure|string ...$columns) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

$columns : Closure|string

Columns list

Return values
static

leftJoinOn()

Adds a JOIN clause with "LEFT JOIN $table ON $conditional".

public leftJoinOn(array<string, \Closure|string>|Closure|string $table, Closure $conditional) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

$conditional : Closure

Conditional expression

Return values
static

leftJoinUsing()

Adds a JOIN clause with "LEFT JOIN $table USING ...$columns".

public leftJoinUsing(array<string, \Closure|string>|Closure|string $table, Closure|string ...$columns) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

$columns : Closure|string

Columns list

Return values
static

leftOuterJoinOn()

Adds a JOIN clause with "LEFT OUTER JOIN $table ON $conditional".

public leftOuterJoinOn(array<string, \Closure|string>|Closure|string $table, Closure $conditional) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

$conditional : Closure

Conditional expression

Return values
static

leftOuterJoinUsing()

Adds a JOIN clause with "LEFT OUTER JOIN $table USING ...$columns".

public leftOuterJoinUsing(array<string, \Closure|string>|Closure|string $table, Closure|string ...$columns) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

$columns : Closure|string

Columns list

Return values
static

naturalJoin()

Adds a JOIN clause with "NATURAL JOIN $table".

public naturalJoin(array<string, \Closure|string>|Closure|string $table) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

Return values
static

naturalLeftJoin()

Adds a JOIN clause with "NATURAL LEFT JOIN $table".

public naturalLeftJoin(array<string, \Closure|string>|Closure|string $table) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

Return values
static

naturalLeftOuterJoin()

Adds a JOIN clause with "NATURAL LEFT OUTER JOIN $table".

public naturalLeftOuterJoin(array<string, \Closure|string>|Closure|string $table) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

Return values
static

naturalRightJoin()

Adds a JOIN clause with "NATURAL RIGHT JOIN $table".

public naturalRightJoin(array<string, \Closure|string>|Closure|string $table) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

Return values
static

naturalRightOuterJoin()

Adds a JOIN clause with "NATURAL RIGHT OUTER JOIN $table".

public naturalRightOuterJoin(array<string, \Closure|string>|Closure|string $table) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

Return values
static

rightJoinOn()

Adds a JOIN clause with "RIGHT JOIN $table ON $conditional".

public rightJoinOn(array<string, \Closure|string>|Closure|string $table, Closure $conditional) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

$conditional : Closure

Conditional expression

Return values
static

rightJoinUsing()

Adds a JOIN clause with "RIGHT JOIN $table USING ...$columns".

public rightJoinUsing(array<string, \Closure|string>|Closure|string $table, Closure|string ...$columns) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

$columns : Closure|string

Columns list

Return values
static

rightOuterJoinOn()

Adds a JOIN clause with "RIGHT OUTER JOIN $table ON $conditional".

public rightOuterJoinOn(array<string, \Closure|string>|Closure|string $table, Closure $conditional) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

$conditional : Closure

Conditional expression

Return values
static

rightOuterJoinUsing()

Adds a JOIN clause with "RIGHT OUTER JOIN $table USING ...$columns".

public rightOuterJoinUsing(array<string, \Closure|string>|Closure|string $table, Closure|string ...$columns) : static
Parameters
$table : array<string, \Closure|string>|Closure|string

Table factor

$columns : Closure|string

Columns list

Return values
static

hasFrom()

Tells if the FROM clause was set.

protected hasFrom([string|null $clause = null ]) : bool
Parameters
$clause : string|null = null

A clause where FROM is required

Tags
throws
LogicException

if FROM is not set, but is required for some other clause

Return values
bool

True if it has FROM, otherwise false

renderFrom()

Renders the FROM clause.

protected renderFrom() : string|null
Return values
string|null

The FROM clause or null if it was not set

renderJoin()

Renders the JOIN clause.

protected renderJoin() : string|null
Return values
string|null

The JOIN clause or null if it was not set

Search results