Fr3nch13/CakePHP Utilities

WindowExpression
in package
implements ExpressionInterface, WindowInterface

This represents a SQL window expression used by aggregate and window functions.

Table of Contents

Interfaces

ExpressionInterface
An interface used by Expression objects.
WindowInterface
This defines the functions used for building window expressions.

Properties

$exclusion  : string|null
$frame  : array<string|int, mixed>|null
$name  : IdentifierExpression
$order  : OrderByExpression|null
$partitions  : array<string|int, ExpressionInterface>

Methods

__clone()  : void
Clone this object and its subtree of expressions.
__construct()  : mixed
excludeCurrent()  : $this
Adds current row frame exclusion.
excludeGroup()  : $this
Adds group frame exclusion.
excludeTies()  : $this
Adds ties frame exclusion.
frame()  : $this
Adds a frame to the window.
groups()  : $this
Adds a simple groups frame to the window.
isNamedOnly()  : bool
Return whether is only a named window expression.
name()  : $this
Sets the window name.
order()  : $this
Adds one or more order clauses to the window.
partition()  : $this
Adds one or more partition expressions to the window.
range()  : $this
Adds a simple range frame to the window.
rows()  : $this
Adds a simple rows frame to the window.
sql()  : string
Converts the Node into a SQL string fragment.
traverse()  : $this
Iterates over each part of the expression recursively for every level of the expressions tree and executes the $callback callable passing as first parameter the instance of the expression currently being iterated.
buildOffsetSql()  : string
Builds frame offset sql.

Properties

Methods

__clone()

Clone this object and its subtree of expressions.

public __clone() : void

__construct()

public __construct([string $name = '' ]) : mixed
Parameters
$name : string = ''

Window name

excludeCurrent()

Adds current row frame exclusion.

public excludeCurrent() : $this
Tags
inheritDoc
Return values
$this

excludeGroup()

Adds group frame exclusion.

public excludeGroup() : $this
Tags
inheritDoc
Return values
$this

excludeTies()

Adds ties frame exclusion.

public excludeTies() : $this
Tags
inheritDoc
Return values
$this

frame()

Adds a frame to the window.

public frame(string $type, mixed $startOffset, string $startDirection, mixed $endOffset, string $endDirection) : $this
Parameters
$type : string

Frame type

$startOffset : mixed

Frame start offset

$startDirection : string

Frame start direction

$endOffset : mixed

Frame end offset

$endDirection : string

Frame end direction

Tags
inheritDoc
Return values
$this

groups()

Adds a simple groups frame to the window.

public groups(int|null $start[, int|null $end = 0 ]) : $this
Parameters
$start : int|null

Frame start

$end : int|null = 0

Frame end If not passed in, only frame start SQL will be generated.

Tags
inheritDoc
Return values
$this

isNamedOnly()

Return whether is only a named window expression.

public isNamedOnly() : bool

These window expressions only specify a named window and do not specify their own partitions, frame or order.

Return values
bool

name()

Sets the window name.

public name(string $name) : $this
Parameters
$name : string

Window name

Return values
$this

order()

Adds one or more order clauses to the window.

public order(mixed $fields) : $this
Parameters
$fields : mixed

Order expressions

Tags
inheritDoc
Return values
$this

partition()

Adds one or more partition expressions to the window.

public partition(mixed $partitions) : $this
Parameters
$partitions : mixed

Partition expressions

Tags
inheritDoc
Return values
$this

range()

Adds a simple range frame to the window.

public range(mixed $start[, mixed $end = 0 ]) : $this
Parameters
$start : mixed

Frame start

$end : mixed = 0

Frame end If not passed in, only frame start SQL will be generated.

Tags
inheritDoc
Return values
$this

rows()

Adds a simple rows frame to the window.

public rows(int|null $start[, int|null $end = 0 ]) : $this
Parameters
$start : int|null

Frame start

$end : int|null = 0

Frame end If not passed in, only frame start SQL will be generated.

Tags
inheritDoc
Return values
$this

sql()

Converts the Node into a SQL string fragment.

public sql(ValueBinder $binder) : string
Parameters
$binder : ValueBinder

Parameter binder

Tags
inheritDoc
Return values
string

traverse()

Iterates over each part of the expression recursively for every level of the expressions tree and executes the $callback callable passing as first parameter the instance of the expression currently being iterated.

public traverse(Closure $callback) : $this
Parameters
$callback : Closure

The callable to apply to all nodes.

Tags
inheritDoc
Return values
$this

buildOffsetSql()

Builds frame offset sql.

protected buildOffsetSql(ValueBinder $binder, ExpressionInterface|string|int|null $offset, string $direction) : string
Parameters
$binder : ValueBinder

Value binder

$offset : ExpressionInterface|string|int|null

Frame offset

$direction : string

Frame offset direction

Return values
string

        
On this page

Search results