Interface WindowInterface
This defines the functions used for building window expressions.
Constants
Method Summary
-
excludeCurrent() public
Adds current row frame exclusion.
-
excludeGroup() public
Adds group frame exclusion.
-
excludeTies() public
Adds ties frame exclusion.
-
frame() public
Adds a frame to the window.
-
groups() public
Adds a simple groups frame to the window.
-
order() public
Adds one or more order clauses to the window.
-
partition() public
Adds one or more partition expressions to the window.
-
range() public
Adds a simple range frame to the window.
-
rows() public
Adds a simple rows frame to the window.
Method Detail
frame() ¶ public
frame(string $type, Cake\Database\ExpressionInterface|string|int|null $startOffset, string $startDirection, Cake\Database\ExpressionInterface|string|int|null $endOffset, string $endDirection): $this
Adds a frame to the window.
Use the range(), rows() or groups() helpers if you need simple
'BETWEEN offset PRECEDING and offset FOLLOWING' frames.
You can specify any direction for both frame start and frame end.
With both $startOffset and $endOffset:
0- 'CURRENT ROW'null- 'UNBOUNDED'
Parameters
-
string$type Frame type
-
Cake\Database\ExpressionInterface|string|int|null$startOffset Frame start offset
-
string$startDirection Frame start direction
-
Cake\Database\ExpressionInterface|string|int|null$endOffset Frame end offset
-
string$endDirection Frame end direction
Returns
$thisThrows
InvalidArgumentExceptionWHen offsets are negative.
groups() ¶ public
groups(int|null $start, int|null $end = 0): $this
Adds a simple groups frame to the window.
See range() for details.
Parameters
-
int|null$start Frame start
-
int|null$end optional Frame end If not passed in, only frame start SQL will be generated.
Returns
$thisorder() ¶ public
order(Cake\Database\ExpressionInterface|Closure|array<Cake\Database\ExpressionInterface|string>|string $fields): $this
Adds one or more order clauses to the window.
Parameters
-
Cake\Database\ExpressionInterface|Closure|array<Cake\Database\ExpressionInterface|string>|string$fields Order expressions
Returns
$thispartition() ¶ public
partition(Cake\Database\ExpressionInterface|Closure|array<Cake\Database\ExpressionInterface|string>|string $partitions): $this
Adds one or more partition expressions to the window.
Parameters
-
Cake\Database\ExpressionInterface|Closure|array<Cake\Database\ExpressionInterface|string>|string$partitions Partition expressions
Returns
$thisrange() ¶ public
range(Cake\Database\ExpressionInterface|string|int|null $start, Cake\Database\ExpressionInterface|string|int|null $end = 0): $this
Adds a simple range frame to the window.
$start:
0- 'CURRENT ROW'null- 'UNBOUNDED PRECEDING'- offset - 'offset PRECEDING'
$end:
0- 'CURRENT ROW'null- 'UNBOUNDED FOLLOWING'- offset - 'offset FOLLOWING'
If you need to use 'FOLLOWING' with frame start or
'PRECEDING' with frame end, use frame() instead.
Parameters
-
Cake\Database\ExpressionInterface|string|int|null$start Frame start
-
Cake\Database\ExpressionInterface|string|int|null$end optional Frame end If not passed in, only frame start SQL will be generated.
Returns
$thisrows() ¶ public
rows(int|null $start, int|null $end = 0): $this
Adds a simple rows frame to the window.
See range() for details.
Parameters
-
int|null$start Frame start
-
int|null$end optional Frame end If not passed in, only frame start SQL will be generated.
Returns
$this