Aplus Framework Database Library

OrderBy

Trait OrderBy.

Tags
see
https://mariadb.com/kb/en/order-by/

Table of Contents

orderBy()  : static
Appends columns to the ORDER BY clause.
orderByAsc()  : static
Appends columns with the ASC direction to the ORDER BY clause.
orderByDesc()  : static
Appends columns with the DESC direction to the ORDER BY clause.
renderOrderBy()  : string|null
Renders the ORDER BY clause.
addOrderBy()  : static
Adds a ORDER BY expression.

Methods

orderBy()

Appends columns to the ORDER BY clause.

public orderBy(Closure|string $column, Closure|string ...$columns) : static
Parameters
$column : Closure|string

The column name or a subquery

$columns : Closure|string

Extra column names and/or subqueries

Return values
static

orderByAsc()

Appends columns with the ASC direction to the ORDER BY clause.

public orderByAsc(Closure|string $column, Closure|string ...$columns) : static
Parameters
$column : Closure|string

The column name or a subquery

$columns : Closure|string

Extra column names and/or subqueries

Return values
static

orderByDesc()

Appends columns with the DESC direction to the ORDER BY clause.

public orderByDesc(Closure|string $column, Closure|string ...$columns) : static
Parameters
$column : Closure|string

The column name or a subquery

$columns : Closure|string

Extra column names and/or subqueries

Return values
static

renderOrderBy()

Renders the ORDER BY clause.

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

The ORDER BY clause or null if it was not set

addOrderBy()

Adds a ORDER BY expression.

private addOrderBy(Closure|string $column, array<string|int, \Closure|string> $columns, string|null $direction) : static
Parameters
$column : Closure|string

The column name or a subquery

$columns : array<string|int, \Closure|string>

Extra column names and/or subqueries

$direction : string|null

ASC, DESC or null for none

Return values
static

Search results