final class OrderItem
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

One ordering or grouping expression with the direction written after it.

It is the item of ORDER BY, of the GROUP BY of releases that accept a direction there, of GROUP_CONCAT ... ORDER BY, and of the PARTITION BY and ORDER BY of a window. No direction means ascending order; the absence is kept as written. The statement that holds the item derives its expression. Source: https://dev.mysql.com/doc/refman/8.4/en/sorting-rows.html.

Holding an ordering expression and its directiondoctest
$item = new \SqlSemantics\Platform\MySql\Statement\Query\OrderItem(new \SqlSemantics\Platform\MySql\Statement\Name\ColumnUse(new \SqlSemantics\Platform\MySql\Model\Statement\Identifier\Name('a')), \SqlSemantics\Platform\MySql\Statement\Query\Direction::Descending);
    [$item->expression->name->value, $item->direction] // => ['a', \SqlSemantics\Platform\MySql\Statement\Query\Direction::Descending]

Properties§

public Scalar $expression
public Direction|null $direction = null

Methods§

public function __construct(public Scalar $expression, public Direction|null $direction = null)

Parameters

$expressionScalarThe ordering expression
$directionDirection|nullThe direction, when written

Test cases 22§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 3
Other tests reaching this symbol 19

Relations§

Instantiated in 4
Constant reads 11
Type declarations 3