PHP Класс Nette\Database\Table\Selection

Selection is based on the great library NotORM http://www.notorm.com written by Jakub Vrana.
Автор: Jakub Vrana
Автор: Jan Skrasek
Наследование: extends Nette\Object, implements Iterator, implements ArrayAccess, implements Countable
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$accessedColumns of touched columns
$aggregation of [conditions => [key => IRow]]; used by GroupedSelection
$cache Nette\Caching\Cache
$context Nette\Database\Context
$conventions Nette\Database\IConventions
$data modifiable data in [primary key => IRow] format
$dataRefreshed boolean
$generalCacheKey string
$globalRefCache cache array of Selection and GroupedSelection prototypes
$keys of primary key values
$name table name
$observeCache should instance observe accessed columns caching
$previousAccessedColumns of earlier touched columns
$primary primary key field name
$primarySequence primary column sequence name, FALSE for autodetection
$refCache mixed
$rows data read from database in [primary key => IRow] format
$specificCacheKey string
$sqlBuilder SqlBuilder

Открытые методы

Метод Описание
__clone ( )
__construct ( Context $context, Nette\Database\IConventions $conventions, $tableName, Nette\Caching\IStorage $cacheStorage = NULL ) Creates filtered table representation.
__destruct ( )
accessColumn ( $key, $selectColumn = TRUE ) : boolean
aggregation ( $function ) : string Executes aggregation function.
alias ( $tableChain, $alias ) : self Aliases table. Example ':book:book_tag.tag', 'tg'
count ( $column = NULL ) : integer Counts number of rows.
createSelectionInstance ( $table = NULL )
current ( ) : Nette\Database\Table\IRow
delete ( ) : integer Deletes all rows in result set.
fetch ( )
fetchAll ( )
fetchAssoc ( $path )
fetchField ( $column = NULL ) : mixed | FALSE Fetches single field.
fetchPairs ( $key = NULL, $value = NULL )
get ( $key ) : Nette\Database\Table\IRow Returns row specified by primary key.
getDataRefreshed ( ) : boolean Returns if selection requeried for more columns.
getName ( ) : string
getPreviousAccessedColumns ( ) : array | false Loads cache of previous accessed columns and returns it.
getPrimary ( $need = TRUE ) : string | array | null
getPrimarySequence ( ) : string
getReferencedTable ( ActiveRow $row, $table, $column = NULL ) : ActiveRow | null | FALSE Returns referenced row.
getReferencingTable ( $table, $column, $active = NULL ) : GroupedSelection Returns referencing rows.
getSql ( ) : string
getSqlBuilder ( ) : SqlBuilder
group ( $columns, $params ) : self Sets group clause, more calls rewrite old value.
having ( $having, $params ) : self Sets having clause, more calls rewrite old value.
insert ( $data ) : Nette\Database\Table\IRow | integer | boolean Inserts row in a table.
joinWhere ( $tableChain, $condition, $params ) : self Adds ON condition when joining specified table, more calls appends with AND.
key ( ) : string
limit ( $limit, $offset = NULL ) : self Sets limit clause, more calls rewrite old values.
max ( $column ) : integer Returns maximum value from a column.
min ( $column ) : integer Returns minimum value from a column.
next ( )
offsetExists ( $key ) : boolean Tests if row exists.
offsetGet ( $key ) : Nette\Database\Table\IRow Returns specified row.
offsetSet ( $key, $value ) : null Mimic row.
offsetUnset ( $key ) : null Removes row from result set.
order ( $columns, $params ) : self Adds order clause, more calls appends to the end.
page ( $page, $itemsPerPage, &$numOfPages = NULL ) : self Sets offset using page number, more calls rewrite old values.
removeAccessColumn ( $key )
rewind ( ) ******************* interface Iterator ****************d*g*
select ( $columns, $params ) : self Adds select clause, more calls appends to the end.
setPrimarySequence ( $sequence ) : self
sum ( $column ) : integer Returns sum of values in a column.
update ( $data ) : integer Updates all rows in result set.
valid ( )
where ( $condition, $params ) : self Adds where condition, more calls appends with AND.
whereOr ( array $parameters ) : self Adds where condition using the OR operator between parameters.
wherePrimary ( $key ) : self Adds condition for primary key.

Защищенные методы

Метод Описание
condition ( $condition, array $params, $tableChain = NULL ) : void Adds condition, more calls appends with AND.
createGroupedSelectionInstance ( $table, $column )
createRow ( array $row )
emptyResultSet ( $clearCache = TRUE, $deleteRererencedCache = TRUE )
execute ( ) ******************* internal ****************d*g*
getGeneralCacheKey ( ) : string Returns general cache key independent on query parameters or sql limit Used e.g. for previously accessed columns caching
getRefTable ( &$refPath ) : self Returns Selection parent for caching.
getSpecificCacheKey ( ) : string Returns object specific cache key dependent on query parameters Used e.g. for reference memory caching
loadRefCache ( ) Loads refCache references
query ( $query )
saveCacheState ( )

Описание методов

__clone() публичный Метод

public __clone ( )

__construct() публичный Метод

Creates filtered table representation.
public __construct ( Context $context, Nette\Database\IConventions $conventions, $tableName, Nette\Caching\IStorage $cacheStorage = NULL )
$context Nette\Database\Context
$conventions Nette\Database\IConventions
$cacheStorage Nette\Caching\IStorage

__destruct() публичный Метод

public __destruct ( )

accessColumn() публичный Метод

public accessColumn ( $key, $selectColumn = TRUE ) : boolean
Результат boolean if selection requeried for more columns.

aggregation() публичный Метод

Executes aggregation function.
public aggregation ( $function ) : string
Результат string

alias() публичный Метод

Aliases table. Example ':book:book_tag.tag', 'tg'
public alias ( $tableChain, $alias ) : self
Результат self

condition() защищенный Метод

Adds condition, more calls appends with AND.
protected condition ( $condition, array $params, $tableChain = NULL ) : void
$params array
Результат void

count() публичный Метод

Counts number of rows.
public count ( $column = NULL ) : integer
Результат integer

createGroupedSelectionInstance() защищенный Метод

protected createGroupedSelectionInstance ( $table, $column )

createRow() защищенный Метод

protected createRow ( array $row )
$row array

createSelectionInstance() публичный Метод

public createSelectionInstance ( $table = NULL )

current() публичный Метод

public current ( ) : Nette\Database\Table\IRow
Результат Nette\Database\Table\IRow

delete() публичный Метод

Deletes all rows in result set.
public delete ( ) : integer
Результат integer number of affected rows

emptyResultSet() защищенный Метод

protected emptyResultSet ( $clearCache = TRUE, $deleteRererencedCache = TRUE )

execute() защищенный Метод

******************* internal ****************d*g*
protected execute ( )

fetch() публичный Метод

public fetch ( )

fetchAll() публичный Метод

public fetchAll ( )

fetchAssoc() публичный Метод

public fetchAssoc ( $path )

fetchField() публичный Метод

Fetches single field.
public fetchField ( $column = NULL ) : mixed | FALSE
Результат mixed | FALSE

fetchPairs() публичный Метод

public fetchPairs ( $key = NULL, $value = NULL )

get() публичный Метод

Returns row specified by primary key.
public get ( $key ) : Nette\Database\Table\IRow
Результат Nette\Database\Table\IRow or FALSE if there is no such row

getDataRefreshed() публичный Метод

Returns if selection requeried for more columns.
public getDataRefreshed ( ) : boolean
Результат boolean

getGeneralCacheKey() защищенный Метод

Returns general cache key independent on query parameters or sql limit Used e.g. for previously accessed columns caching
protected getGeneralCacheKey ( ) : string
Результат string

getName() публичный Метод

public getName ( ) : string
Результат string

getPreviousAccessedColumns() публичный Метод

Loads cache of previous accessed columns and returns it.
public getPreviousAccessedColumns ( ) : array | false
Результат array | false

getPrimary() публичный Метод

public getPrimary ( $need = TRUE ) : string | array | null
Результат string | array | null

getPrimarySequence() публичный Метод

public getPrimarySequence ( ) : string
Результат string

getRefTable() защищенный Метод

Returns Selection parent for caching.
protected getRefTable ( &$refPath ) : self
Результат self

getReferencedTable() публичный Метод

Returns referenced row.
public getReferencedTable ( ActiveRow $row, $table, $column = NULL ) : ActiveRow | null | FALSE
$row ActiveRow
Результат ActiveRow | null | FALSE NULL if the row does not exist, FALSE if the relationship does not exist

getReferencingTable() публичный Метод

Returns referencing rows.
public getReferencingTable ( $table, $column, $active = NULL ) : GroupedSelection
Результат GroupedSelection

getSpecificCacheKey() защищенный Метод

Returns object specific cache key dependent on query parameters Used e.g. for reference memory caching
protected getSpecificCacheKey ( ) : string
Результат string

getSql() публичный Метод

public getSql ( ) : string
Результат string

getSqlBuilder() публичный Метод

public getSqlBuilder ( ) : SqlBuilder
Результат SqlBuilder

group() публичный Метод

Sets group clause, more calls rewrite old value.
public group ( $columns, $params ) : self
Результат self

having() публичный Метод

Sets having clause, more calls rewrite old value.
public having ( $having, $params ) : self
Результат self

insert() публичный Метод

Inserts row in a table.
public insert ( $data ) : Nette\Database\Table\IRow | integer | boolean
Результат Nette\Database\Table\IRow | integer | boolean Returns IRow or number of affected rows for Selection or table without primary key

joinWhere() публичный Метод

Adds ON condition when joining specified table, more calls appends with AND.
public joinWhere ( $tableChain, $condition, $params ) : self
Результат self

key() публичный Метод

public key ( ) : string
Результат string row ID

limit() публичный Метод

Sets limit clause, more calls rewrite old values.
public limit ( $limit, $offset = NULL ) : self
Результат self

loadRefCache() защищенный Метод

Loads refCache references
protected loadRefCache ( )

max() публичный Метод

Returns maximum value from a column.
public max ( $column ) : integer
Результат integer

min() публичный Метод

Returns minimum value from a column.
public min ( $column ) : integer
Результат integer

next() публичный Метод

public next ( )

offsetExists() публичный Метод

Tests if row exists.
public offsetExists ( $key ) : boolean
Результат boolean

offsetGet() публичный Метод

Returns specified row.
public offsetGet ( $key ) : Nette\Database\Table\IRow
Результат Nette\Database\Table\IRow or NULL if there is no such row

offsetSet() публичный Метод

Mimic row.
public offsetSet ( $key, $value ) : null
Результат null

offsetUnset() публичный Метод

Removes row from result set.
public offsetUnset ( $key ) : null
Результат null

order() публичный Метод

Adds order clause, more calls appends to the end.
public order ( $columns, $params ) : self
Результат self

page() публичный Метод

Sets offset using page number, more calls rewrite old values.
public page ( $page, $itemsPerPage, &$numOfPages = NULL ) : self
Результат self

query() защищенный Метод

protected query ( $query )

removeAccessColumn() публичный Метод

public removeAccessColumn ( $key )

rewind() публичный Метод

******************* interface Iterator ****************d*g*
public rewind ( )

saveCacheState() защищенный Метод

protected saveCacheState ( )

select() публичный Метод

Adds select clause, more calls appends to the end.
public select ( $columns, $params ) : self
Результат self

setPrimarySequence() публичный Метод

public setPrimarySequence ( $sequence ) : self
Результат self

sum() публичный Метод

Returns sum of values in a column.
public sum ( $column ) : integer
Результат integer

update() публичный Метод

Joins in UPDATE are supported only in MySQL
public update ( $data ) : integer
Результат integer number of affected rows

valid() публичный Метод

public valid ( )

where() публичный Метод

Adds where condition, more calls appends with AND.
public where ( $condition, $params ) : self
Результат self

whereOr() публичный Метод

More calls appends with AND.
public whereOr ( array $parameters ) : self
$parameters array
Результат self

wherePrimary() публичный Метод

Adds condition for primary key.
public wherePrimary ( $key ) : self
Результат self

Описание свойств

$accessedColumns защищенное свойство

of touched columns
protected $accessedColumns

$aggregation защищенное свойство

of [conditions => [key => IRow]]; used by GroupedSelection
protected $aggregation

$cache защищенное свойство

protected Cache,Nette\Caching $cache
Результат Nette\Caching\Cache

$context защищенное свойство

protected Context,Nette\Database $context
Результат Nette\Database\Context

$conventions защищенное свойство

protected IConventions,Nette\Database $conventions
Результат Nette\Database\IConventions

$data защищенное свойство

modifiable data in [primary key => IRow] format
protected $data

$dataRefreshed защищенное свойство

protected bool $dataRefreshed
Результат boolean

$generalCacheKey защищенное свойство

protected string $generalCacheKey
Результат string

$globalRefCache защищенное свойство

cache array of Selection and GroupedSelection prototypes
protected $globalRefCache

$keys защищенное свойство

of primary key values
protected $keys

$name защищенное свойство

table name
protected $name

$observeCache защищенное свойство

should instance observe accessed columns caching
protected $observeCache

$previousAccessedColumns защищенное свойство

of earlier touched columns
protected $previousAccessedColumns

$primary защищенное свойство

primary key field name
protected $primary

$primarySequence защищенное свойство

primary column sequence name, FALSE for autodetection
protected $primarySequence

$refCache защищенное свойство

protected mixed $refCache
Результат mixed

$rows защищенное свойство

data read from database in [primary key => IRow] format
protected $rows

$specificCacheKey защищенное свойство

protected string $specificCacheKey
Результат string

$sqlBuilder защищенное свойство

protected SqlBuilder,Nette\Database\Table $sqlBuilder
Результат SqlBuilder