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 deprecated
Adds one or more order by clauses to the window.
-
orderBy() public
Adds one or more order by 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
$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 by clauses to the window.
Parameters
-
Cake\Database\ExpressionInterfaceClosure|arrayCake\Database\ExpressionInterface|string>|string
$fields Order expressions
Returns
$this
orderBy() ¶ public
orderBy(Cake\Database\ExpressionInterfaceClosure|arrayCake\Database\ExpressionInterface|string>|string $fields): $this
Adds one or more order by 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