This defines the functions used for building window expressions.
string
'FOLLOWING'
string
'GROUPS'
string
'PRECEDING'
string
'RANGE'
string
'ROWS'
excludeCurrent()
Adds current row frame exclusion.
$this
excludeGroup()
Adds group frame exclusion.
$this
excludeTies()
Adds ties frame exclusion.
$this
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'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
$this
InvalidArgumentException
groups(?int $start, ?int $end)
Adds a simple groups frame to the window.
See range()
for details.
int|null
$start Frame start
int|null
$end optional Frame end If not passed in, only frame start SQL will be generated.
$this
order(mixed $fields)
Adds one or more order clauses to the window.
\Closure|(\Cake\Database\ExpressionInterface|string)[]|\Cake\Database\ExpressionInterface|string
$fields Order expressions
$this
partition(mixed $partitions)
Adds one or more partition expressions to the window.
\Closure|(\Cake\Database\ExpressionInterface|string)[]|\Cake\Database\ExpressionInterface|string
$partitions Partition expressions
$this
range(mixed $start, mixed $end)
Adds a simple range frame to the window.
$start
:
0
- 'CURRENT ROW'null
- 'UNBOUNDED PRECEDING'$end
:
0
- 'CURRENT ROW'null
- 'UNBOUNDED FOLLOWING'If you need to use 'FOLLOWING' with frame start or 'PRECEDING' with frame end, use frame()
instead.
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.
$this
rows(?int $start, ?int $end)
Adds a simple rows frame to the window.
See range()
for details.
int|null
$start Frame start
int|null
$end optional Frame end If not passed in, only frame start SQL will be generated.
$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