Fr3nch13/CakePHP Utilities

WindowInterface

This defines the functions used for building window expressions.

Table of Contents

Constants

FOLLOWING  = 'FOLLOWING'
GROUPS  = 'GROUPS'
PRECEDING  = 'PRECEDING'
RANGE  = 'RANGE'
ROWS  = 'ROWS'

Methods

excludeCurrent()  : $this
Adds current row frame exclusion.
excludeGroup()  : $this
Adds group frame exclusion.
excludeTies()  : $this
Adds ties frame exclusion.
frame()  : $this
Adds a frame to the window.
groups()  : $this
Adds a simple groups frame to the window.
order()  : $this
Adds one or more order clauses to the window.
partition()  : $this
Adds one or more partition expressions to the window.
range()  : $this
Adds a simple range frame to the window.
rows()  : $this
Adds a simple rows frame to the window.

Constants

Methods

excludeCurrent()

Adds current row frame exclusion.

public excludeCurrent() : $this
Return values
$this

excludeGroup()

Adds group frame exclusion.

public excludeGroup() : $this
Return values
$this

excludeTies()

Adds ties frame exclusion.

public excludeTies() : $this
Return values
$this

frame()

Adds a frame to the window.

public frame(string $type, ExpressionInterface|string|int|null $startOffset, string $startDirection, ExpressionInterface|string|int|null $endOffset, string $endDirection) : $this

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
$type : string

Frame type

$startOffset : ExpressionInterface|string|int|null

Frame start offset

$startDirection : string

Frame start direction

$endOffset : ExpressionInterface|string|int|null

Frame end offset

$endDirection : string

Frame end direction

Tags
throws
InvalidArgumentException

WHen offsets are negative.

psalm-param

self::RANGE|self::ROWS|self::GROUPS $type

psalm-param

self::PRECEDING|self::FOLLOWING $startDirection

psalm-param

self::PRECEDING|self::FOLLOWING $endDirection

Return values
$this

groups()

Adds a simple groups frame to the window.

public groups(int|null $start[, int|null $end = 0 ]) : $this

See range() for details.

Parameters
$start : int|null

Frame start

$end : int|null = 0

Frame end If not passed in, only frame start SQL will be generated.

Return values
$this

range()

Adds a simple range frame to the window.

public range(ExpressionInterface|string|int|null $start[, ExpressionInterface|string|int|null $end = 0 ]) : $this

$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
$start : ExpressionInterface|string|int|null

Frame start

$end : ExpressionInterface|string|int|null = 0

Frame end If not passed in, only frame start SQL will be generated.

Return values
$this

rows()

Adds a simple rows frame to the window.

public rows(int|null $start[, int|null $end = 0 ]) : $this

See range() for details.

Parameters
$start : int|null

Frame start

$end : int|null = 0

Frame end If not passed in, only frame start SQL will be generated.

Return values
$this

        
On this page

Search results