On this page
Interface WindowInterface
This defines the functions used for building window expressions.
Constants
-
string
FOLLOWING'FOLLOWING'
-
string
GROUPS'GROUPS'
-
string
PRECEDING'PRECEDING'
-
string
RANGE'RANGE'
-
string
ROWS'ROWS'
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
excludeCurrent() public
excludeCurrent(): $this
Adds current row frame exclusion.
Returns
$this
excludeGroup() public
excludeGroup(): $this
Adds group frame exclusion.
Returns
$this
excludeTies() public
excludeTies(): $this
Adds ties frame exclusion.
Returns
$this
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
$this
Throws
InvalidArgumentException
WHen 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
$this
order() public
order(Cake\Database\ExpressionInterfaceClosure|arrayCake\Database\ExpressionInterface|string>|string $fields): $this
Adds one or more order clauses to the window.
Parameters
Cake\Database\ExpressionInterfaceClosure|arrayCake\Database\ExpressionInterface|string>|string
$fields-
Order expressions
Returns
$this
partition() public
partition(Cake\Database\ExpressionInterfaceClosure|arrayCake\Database\ExpressionInterface|string>|string $partitions): $this
Adds one or more partition expressions to the window.
Parameters
Cake\Database\ExpressionInterfaceClosure|arrayCake\Database\ExpressionInterface|string>|string
$partitions-
Partition expressions
Returns
$this
range() 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
$this
rows() 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
© 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.4/interface-Cake.Database.Expression.WindowInterface.html