Interface WindowInterface
This defines the functions used for building window expressions.
Constants summary
-
stringFOLLOWING'FOLLOWING' -
stringGROUPS'GROUPS' -
stringPRECEDING'PRECEDING' -
stringRANGE'RANGE' -
stringROWS'ROWS'
Method Summary
Method Detail
excludeCurrent() public
excludeCurrent()
Adds current row frame exclusion.
Returns
$thisexcludeGroup() public
excludeGroup()
Adds group frame exclusion.
Returns
$thisexcludeTies() public
excludeTies()
Adds ties frame exclusion.
Returns
$thisframe() public
frame(string $type, mixed $startOffset, string $startDirection, mixed $endOffset, string $endDirection)
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
-
int|string|\Cake\Database\ExpressionInterface|null$startOffset Frame start offset
-
string$startDirection Frame start direction
-
int|string|\Cake\Database\ExpressionInterface|null$endOffset Frame end offset
-
string$endDirection Frame end direction
Returns
$thisThrows
InvalidArgumentExceptionWHen offsets are negative.
groups() public
groups(?int $start, ?int $end)
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(mixed $fields)
Adds one or more order clauses to the window.
Parameters
-
\Closure|(\Cake\Database\ExpressionInterface|string)[]|\Cake\Database\ExpressionInterface|string$fields Order expressions
Returns
$thispartition() public
partition(mixed $partitions)
Adds one or more partition expressions to the window.
Parameters
-
\Closure|(\Cake\Database\ExpressionInterface|string)[]|\Cake\Database\ExpressionInterface|string$partitions Partition expressions
Returns
$thisrange() public
range(mixed $start, mixed $end)
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
-
int|string|\Cake\Database\ExpressionInterface|null$start Frame start
-
int|string|\Cake\Database\ExpressionInterface|null$end optional Frame end If not passed in, only frame start SQL will be generated.
Returns
$thisrows() public
rows(?int $start, ?int $end)
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
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/interface-Cake.Database.Expression.WindowInterface.html