class GroupedSelection extends Selection

Representation of filtered table grouped by some column.

GroupedSelection is based on the great library NotORM http://www.notorm.com written by Jakub Vrana.

Properties

protected Selection $refTable
protected mixed $refCacheCurrent
protected string $column
protected int $active

Methods

__construct(Context $context, IConventions $conventions, $tableName, $column, Selection $refTable, IStorage $cacheStorage = NULL)

Creates filtered and grouped table representation.

setActive($active)

Sets active group.

select($columns)

Adds select clause, more calls appends to the end.

order($columns)

Adds order clause, more calls appends to the end.

string
aggregation($function)

Executes aggregation function.

int
count($column = NULL)

Counts number of rows.

execute()

No description

getRefTable($refPath)

Returns Selection parent for caching.

loadRefCache()

Loads refCache references

emptyResultSet($saveCache = TRUE, $deleteRererencedCache = TRUE)

No description

IRow|int|bool
insert($data)

Inserts row in a table.

int
update($data)

Updates all rows in result set.

int
delete()

Deletes all rows in result set.

Details

at line 43
__construct(Context $context, IConventions $conventions, $tableName, $column, Selection $refTable, IStorage $cacheStorage = NULL)

Creates filtered and grouped table representation.

Parameters

Context $context
IConventions $conventions
$tableName
$column
Selection $refTable
IStorage $cacheStorage

at line 57
GroupedSelection setActive($active)

internal  
 

Sets active group.

Parameters

$active

Return Value

GroupedSelection

at line 64
Selection select($columns)

Adds select clause, more calls appends to the end.

Parameters

$columns

Return Value

Selection

at line 74
Selection order($columns)

Adds order clause, more calls appends to the end.

Parameters

$columns

Return Value

Selection

at line 88
string aggregation($function)

Executes aggregation function.

Parameters

$function

Return Value

string

at line 114
int count($column = NULL)

Counts number of rows.

Parameters

$column

Return Value

int

at line 124
protected execute()

No description

at line 176
protected Selection getRefTable($refPath)

Returns Selection parent for caching.

Parameters

$refPath

Return Value

Selection

at line 189
protected loadRefCache()

Loads refCache references

at line 205
protected emptyResultSet($saveCache = TRUE, $deleteRererencedCache = TRUE)

No description

Parameters

$saveCache
$deleteRererencedCache

at line 214
IRow|int|bool insert($data)

Inserts row in a table.

Parameters

$data

Return Value

IRow|int|bool

Returns IRow or number of affected rows for Selection or table without primary key

at line 232
int update($data)

Updates all rows in result set.

Joins in UPDATE are supported only in MySQL

Parameters

$data

Return Value

int

number of affected rows

at line 245
int delete()

Deletes all rows in result set.

Return Value

int

number of affected rows