Selection
class Selection extends Object implements Iterator, IRowContainer, ArrayAccess, Countable
Filtered table representation.
Selection is based on the great library NotORM http://www.notorm.com written by Jakub Vrana.
Properties
protected Connection | $connection | ||
protected IReflection | $reflection | ||
protected Cache | $cache | ||
protected SqlBuilder | $sqlBuilder | ||
protected string | $name | ||
protected string | $primary | ||
protected string|bool | $primarySequence | ||
protected IRow[] | $rows | ||
protected IRow[] | $data | ||
protected bool | $dataRefreshed | ||
protected mixed | $globalRefCache | ||
protected mixed | $refCache | ||
protected string | $generalCacheKey | ||
protected string | $specificCacheKey | ||
protected array | $aggregation | ||
protected array | $accessedColumns | ||
protected array | $previousAccessedColumns | ||
protected bool | $observeCache | ||
protected array | $keys | ||
string read-only | $sql |
Methods
Creates filtered table representation.
No description
No description
No description
No description
No description
No description
No description
No description
No description
Loads cache of previous accessed columns and returns it.
No description
No description
No description
No description
Adds condition for primary key.
Adds where condition, more calls appends with AND.
Sets offset using page number, more calls rewrite old values.
Executes aggregation function.
Counts number of rows.
Returns minimum value from a column.
Returns maximum value from a column.
Returns sum of values in a column.
No description
No description
No description
No description
No description
No description
No description
Returns Selection parent for caching.
Loads refCache references
Returns general cache key independent on query parameters or sql limit Used e.g. for previously accessed columns caching
Returns object specific cache key dependent on query parameters Used e.g. for reference memory caching
No description
No description
Returns if selection requeried for more columns.
Updates all rows in result set.
Deletes all rows in result set.
Returns referenced row.
Returns referencing rows.
No description
No description
No description
No description
Mimic row.
Tests if row exists.
Removes row from result set.
Details
at line 88
__construct(Connection $connection, $table, IReflection $reflection, IStorage $cacheStorage = NULL)
Creates filtered table representation.
at line 100
__destruct()
No description
at line 106
__clone()
No description
at line 115
Connection
getConnection()
No description
at line 124
IReflection
getDatabaseReflection()
No description
at line 133
string
getName()
No description
at line 143
string|array
getPrimary($need = TRUE)
No description
at line 155
string
getPrimarySequence()
No description
at line 178
Selection
setPrimarySequence($sequence)
No description
at line 188
string
getSql()
No description
at line 199
array|false
getPreviousAccessedColumns()
internal |
Loads cache of previous accessed columns and returns it.
at line 216
SqlBuilder
getSqlBuilder()
internal |
No description
at line 230
IRow
get($key)
Returns row specified by primary key.
at line 240
IRow|bool
fetch()
No description
at line 252
array
fetchPairs($key = NULL, $value = NULL)
No description
at line 261
IRow[]
fetchAll()
No description
at line 275
Selection
select($columns)
Adds select clause, more calls appends to the end.
at line 288
Selection
wherePrimary($key)
Adds condition for primary key.
at line 315
Selection
where($condition, $parameters = array())
Adds where condition, more calls appends with AND.
at line 339
Selection
order($columns)
Adds order clause, more calls appends to the end.
at line 353
Selection
limit($limit, $offset = NULL)
Sets limit clause, more calls rewrite old values.
at line 367
Selection
page($page, $itemsPerPage, $numOfPages = NULL)
Sets offset using page number, more calls rewrite old values.
at line 381
Selection
group($columns)
Sets group clause, more calls rewrite old value.
at line 394
Selection
having($having)
Sets having clause, more calls rewrite old value.
at line 410
string
aggregation($function)
Executes aggregation function.
at line 426
int
count($column = NULL)
Counts number of rows.
at line 441
int
min($column)
Returns minimum value from a column.
at line 452
int
max($column)
Returns maximum value from a column.
at line 463
int
sum($column)
Returns sum of values in a column.
at line 472
protected
execute()
No description
at line 515
protected
createRow(array $row)
No description
at line 521
createSelectionInstance($table = NULL)
No description
at line 527
protected
createGroupedSelectionInstance($table, $column)
No description
at line 533
protected
query($query)
No description
at line 539
protected
emptyResultSet($saveCache = TRUE)
No description
at line 552
protected
saveCacheState()
No description
at line 574
protected Selection
getRefTable($refPath)
Returns Selection parent for caching.
at line 583
protected
loadRefCache()
Loads refCache references
at line 593
protected string
getGeneralCacheKey()
Returns general cache key independent on query parameters or sql limit Used e.g. for previously accessed columns caching
at line 608
protected string
getSpecificCacheKey()
Returns object specific cache key dependent on query parameters Used e.g. for reference memory caching
at line 623
accessColumn($key, $selectColumn = TRUE)
internal |
No description
at line 678
removeAccessColumn($key)
internal |
No description
at line 690
bool
getDataRefreshed()
Returns if selection requeried for more columns.
at line 704
IRow|int|bool
insert($data)
Inserts row in a table.
at line 767
int
update($data)
Updates all rows in result set.
Joins in UPDATE are supported only in MySQL
at line 791
int
delete()
Deletes all rows in result set.
at line 807
Selection
getReferencedTable($table, $column, $checkPrimaryKey)
Returns referenced row.
at line 843
GroupedSelection
getReferencingTable($table, $column, $active = NULL)
Returns referencing rows.
at line 860
rewind()
No description
at line 869
IRow
current()
No description
at line 882
string
key()
No description
at line 888
next()
No description
at line 894
valid()
No description
at line 909
null
offsetSet($key, $value)
Mimic row.
at line 921
IRow
offsetGet($key)
Returns specified row.
at line 933
bool
offsetExists($key)
Tests if row exists.
at line 945
null
offsetUnset($key)
Removes row from result set.