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 Context | $context | ||
protected IConventions | $conventions | ||
protected Cache | $cache | ||
protected SqlBuilder | $sqlBuilder | ||
protected string | $name | ||
protected string|array|null | $primary | ||
protected string|bool | $primarySequence | ||
protected IRow[] | $rows | ||
protected IRow[] | $data | ||
protected bool | $dataRefreshed | ||
protected mixed | $globalRefCache | ||
protected mixed | $refCache | ||
protected string | $generalCacheKey | ||
protected array | $generalCacheTraceKey | ||
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
Loads cache of previous accessed columns and returns it.
No description
No description
Fetches single field.
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 referencing rows.
No description
No description
No description
No description
Mimic row.
Tests if row exists.
Removes row from result set.
Details
at line 91
__construct(Context $context, IConventions $conventions, $tableName, IStorage $cacheStorage = NULL)
Creates filtered table representation.
at line 104
__destruct()
No description
at line 110
__clone()
No description
at line 117
getConnection()
deprecated
deprecated
No description
at line 125
getDatabaseReflection()
deprecated
deprecated
No description
at line 135
string
getName()
No description
at line 145
string|array|null
getPrimary($need = TRUE)
No description
at line 157
string
getPrimarySequence()
No description
at line 171
Selection
setPrimarySequence($sequence)
No description
at line 181
string
getSql()
No description
at line 192
array|false
getPreviousAccessedColumns()
internal |
Loads cache of previous accessed columns and returns it.
at line 209
SqlBuilder
getSqlBuilder()
internal |
No description
at line 223
IRow
get($key)
Returns row specified by primary key.
at line 233
IRow|bool
fetch()
No description
at line 247
mixed|false
fetchField($column = NULL)
Fetches single field.
at line 265
array
fetchPairs($key = NULL, $value = NULL)
No description
at line 274
IRow[]
fetchAll()
No description
at line 283
array
fetchAssoc($path)
No description
at line 298
Selection
select($columns)
Adds select clause, more calls appends to the end.
at line 311
Selection
wherePrimary($key)
Adds condition for primary key.
at line 338
Selection
where($condition, $parameters = array())
Adds where condition, more calls appends with AND.
at line 362
Selection
order($columns)
Adds order clause, more calls appends to the end.
at line 376
Selection
limit($limit, $offset = NULL)
Sets limit clause, more calls rewrite old values.
at line 390
Selection
page($page, $itemsPerPage, $numOfPages = NULL)
Sets offset using page number, more calls rewrite old values.
at line 404
Selection
group($columns)
Sets group clause, more calls rewrite old value.
at line 417
Selection
having($having)
Sets having clause, more calls rewrite old value.
at line 433
string
aggregation($function)
Executes aggregation function.
at line 449
int
count($column = NULL)
Counts number of rows.
at line 464
int
min($column)
Returns minimum value from a column.
at line 475
int
max($column)
Returns maximum value from a column.
at line 486
int
sum($column)
Returns sum of values in a column.
at line 495
protected
execute()
No description
at line 538
protected
createRow(array $row)
No description
at line 544
createSelectionInstance($table = NULL)
No description
at line 550
protected
createGroupedSelectionInstance($table, $column)
No description
at line 556
protected
query($query)
No description
at line 562
protected
emptyResultSet($saveCache = TRUE, $deleteRererencedCache = TRUE)
No description
at line 583
protected
saveCacheState()
No description
at line 605
protected Selection
getRefTable($refPath)
Returns Selection parent for caching.
at line 614
protected
loadRefCache()
Loads refCache references
at line 624
protected string
getGeneralCacheKey()
Returns general cache key independent on query parameters or sql limit Used e.g. for previously accessed columns caching
at line 649
protected string
getSpecificCacheKey()
Returns object specific cache key dependent on query parameters Used e.g. for reference memory caching
at line 665
bool
accessColumn($key, $selectColumn = TRUE)
internal |
No description
at line 721
removeAccessColumn($key)
internal |
No description
at line 733
bool
getDataRefreshed()
Returns if selection requeried for more columns.
at line 747
IRow|int|bool
insert($data)
Inserts row in a table.
at line 816
int
update($data)
Updates all rows in result set.
Joins in UPDATE are supported only in MySQL
at line 840
int
delete()
Deletes all rows in result set.
at line 856
ActiveRow|null|false
getReferencedTable(ActiveRow $row, $table, $column = NULL)
Returns referenced row.
at line 905
GroupedSelection
getReferencingTable($table, $column, $active = NULL)
Returns referencing rows.
at line 932
rewind()
No description
at line 941
IRow
current()
No description
at line 954
string
key()
No description
at line 960
next()
No description
at line 966
valid()
No description
at line 981
null
offsetSet($key, $value)
Mimic row.
at line 993
IRow
offsetGet($key)
Returns specified row.
at line 1005
bool
offsetExists($key)
Tests if row exists.
at line 1017
null
offsetUnset($key)
Removes row from result set.