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
파일 보기 프로젝트 열기: bluzphp/framework 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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