PHP Класс Bluz\Db\Row

Example of Users\Row namespace Application\Users; class Row extends \Bluz\Db\Row { public function beforeInsert() { $this->created = gmdate('Y-m-d H:i:s'); } public function beforeUpdate() { $this->updated = gmdate('Y-m-d H:i:s'); } } $userRow = new \Application\Users\Row(); $userRow -> login = 'username'; $userRow -> save();
Автор: Anton Shevchuk
Наследование: implements JsonSerializable, implements ArrayAccess, use trait Bluz\Common\Container\Container, use trait Bluz\Common\Container\ArrayAccess, use trait Bluz\Common\Container\JsonSerialize, use trait Bluz\Common\Container\MagicAccess
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$clean array This is set to a copy of $data when the data is fetched from a database, specified as a new tuple in the constructor, or when dirty data is posted to the database with save().
$relations relations rows
$table instance of Table class
$tableClass name of Table class

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

Метод Описание
__construct ( array $data = [] ) Create Row instance
__debugInfo ( ) : array Magic method for var_dump()
__sleep ( ) : string[] List of required for serialization properties
__toString ( ) : string Cast to string as class name
assert ( array | object $data ) : boolean Assert input data
delete ( ) : integer Delete existing row
getRelation ( string $modelName ) : Row | false Get relation by model name
getRelations ( string $modelName ) : array Get relations by model name
getTable ( ) : Table Returns the table object, or null if this is disconnected row
refresh ( ) : void Refreshes properties from the database
save ( ) : mixed Saves the properties to the database.
setRelation ( Row $row ) : Row Set relation
setTable ( Table $table ) : self Setup Table instance
validate ( array | object $data ) : boolean Validate input data

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

Метод Описание
afterDelete ( ) : void Allows post-delete logic to be applied to row.
afterInsert ( ) : void Allows post-insert logic to be applied to row.
afterRead ( ) : void After read data from Db
afterSave ( ) : void Allows post-insert and post-update logic to be applied to row.
afterUpdate ( ) : void Allows post-update logic to be applied to row.
beforeDelete ( ) : void Allows pre-delete logic to be applied to row.
beforeInsert ( ) : void Allows pre-insert logic to be applied to row.
beforeSave ( ) : void Allows pre-insert and pre-update logic to be applied to row.
beforeUpdate ( ) : void Allows pre-update logic to be applied to row.
doInsert ( ) : mixed Insert row to Db
doUpdate ( ) : integer Update row
getPrimaryKey ( ) : array Retrieves an associative array of primary keys, if it exists

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

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

Create Row instance
public __construct ( array $data = [] )
$data array

__debugInfo() публичный метод

Magic method for var_dump()
См. также: var_dump()
public __debugInfo ( ) : array
Результат array

__sleep() публичный метод

List of required for serialization properties
public __sleep ( ) : string[]
Результат string[]

__toString() публичный метод

Cast to string as class name
public __toString ( ) : string
Результат string

afterDelete() защищенный метод

Subclasses may override this method
protected afterDelete ( ) : void
Результат void

afterInsert() защищенный метод

Subclasses may override this method
protected afterInsert ( ) : void
Результат void

afterRead() защищенный метод

After read data from Db
protected afterRead ( ) : void
Результат void

afterSave() защищенный метод

Subclasses may override this method
protected afterSave ( ) : void
Результат void

afterUpdate() защищенный метод

Subclasses may override this method
protected afterUpdate ( ) : void
Результат void

assert() публичный метод

Assert input data
public assert ( array | object $data ) : boolean
$data array | object
Результат boolean

beforeDelete() защищенный метод

Subclasses may override this method
protected beforeDelete ( ) : void
Результат void

beforeInsert() защищенный метод

Subclasses may override this method
protected beforeInsert ( ) : void
Результат void

beforeSave() защищенный метод

Subclasses may override this method
protected beforeSave ( ) : void
Результат void

beforeUpdate() защищенный метод

Subclasses may override this method
protected beforeUpdate ( ) : void
Результат void

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

Delete existing row
public delete ( ) : integer
Результат integer The number of deleted rows

doInsert() защищенный метод

Insert row to Db
protected doInsert ( ) : mixed
Результат mixed The primary key value(s), as an associative array if the key is compound, or a scalar if the key is single-column

doUpdate() защищенный метод

Update row
protected doUpdate ( ) : integer
Результат integer The number of rows updated

getPrimaryKey() защищенный метод

Retrieves an associative array of primary keys, if it exists
protected getPrimaryKey ( ) : array
Результат array

getRelation() публичный метод

Get relation by model name
public getRelation ( string $modelName ) : Row | false
$modelName string
Результат Row | false

getRelations() публичный метод

Get relations by model name
public getRelations ( string $modelName ) : array
$modelName string
Результат array

getTable() публичный метод

Returns the table object, or null if this is disconnected row
public getTable ( ) : Table
Результат Table

refresh() публичный метод

Refreshes properties from the database
public refresh ( ) : void
Результат void

save() публичный метод

This performs an intelligent insert/update, and reloads the properties with fresh data from the table on success.
public save ( ) : mixed
Результат mixed The primary key value(s), as an associative array if the key is compound, or a scalar if the key is single-column

setRelation() публичный метод

Set relation
public setRelation ( Row $row ) : Row
$row Row
Результат Row

setTable() публичный метод

Setup Table instance
public setTable ( Table $table ) : self
$table Table
Результат self

validate() публичный метод

Validate input data
public validate ( array | object $data ) : boolean
$data array | object
Результат boolean

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

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

This is set to a copy of $data when the data is fetched from a database, specified as a new tuple in the constructor, or when dirty data is posted to the database with save().
protected array $clean
Результат array

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

relations rows
protected $relations

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

instance of Table class
protected $table

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

name of Table class
protected $tableClass