Methods summary
public
|
#
__construct( Nette\Database\Connection $db )
Constructor loads connection
Constructor loads connection
Parameters
|
public
Nette\Database\Table\Selection
|
#
getTable( string $tableName = NULL )
Returns object representing database table
Returns object representing database table
Parameters
- $tableName
- name of database table
Returns
Nette\Database\Table\Selection
|
protected
String
|
#
getTableName( )
Gets table name from class name
Gets table name from class name
Returns
String
|
protected
array
|
#
trimArray( array $allowedKeys, array $data )
Helper function, trims data array for only specified (allowed) keys
- used typically for safety reasons, should be used before saving to DB
- e.g. $dataToSubmit = trimArray(array('safeAttr1', 'safeAttr2'), $dataFromForm));
Helper function, trims data array for only specified (allowed) keys
- used typically for safety reasons, should be used before saving to DB
- e.g. $dataToSubmit = trimArray(array('safeAttr1', 'safeAttr2'), $dataFromForm));
Parameters
- $allowedKeys
- array of strings
- $data
- data array
Returns
array
|
public
Nette\Database\Table\Selection
|
#
findAll( )
Return all rows from table
Return all rows from table
Returns
Nette\Database\Table\Selection
|
public
Nette\Database\Table\Selection
|
#
findBy( array $by )
Return rows according to filter, e.g. array('name' => 'John')
Return rows according to filter, e.g. array('name' => 'John')
Parameters
- $by
- criteria, by which data are filtered
Returns
Nette\Database\Table\Selection
|
public
Nette\Database\Table\Selection
|
#
findById( integer $id )
Returns one row
Parameters
Returns
Nette\Database\Table\Selection
|
public
Nette\Database\Table\ActiveRow
|
#
insert( array $data )
Insert new row
Parameters
Returns
Nette\Database\Table\ActiveRow
|
public
integer
|
#
update( integer $id, array $data )
Updates specified row
Parameters
Returns
integer number of affected rows
|
public
Nette\Database\Connection
|
#
getConnection( )
Returns DB connection
Returns
Nette\Database\Connection
|