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();
Afficher le fichier
Open project: bluzphp/framework
Class Usage Examples
Свойство | Type | Description | |
---|---|---|---|
$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 |
Méthode | Description | |
---|---|---|
__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 ) : |
Get relation by model name | |
getRelations ( string $modelName ) : array | Get relations by model name | |
getTable ( ) : |
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 ( |
Set relation | |
setTable ( |
Setup Table instance | |
validate ( array | object $data ) : boolean | Validate input data |
Méthode | Description | |
---|---|---|
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 |
public __construct ( array $data = [] ) | ||
$data | array |
public __debugInfo ( ) : array | ||
Résultat | array |
public __sleep ( ) : string[] | ||
Résultat | string[] |
public __toString ( ) : string | ||
Résultat | string |
protected afterDelete ( ) : void | ||
Résultat | void |
protected afterInsert ( ) : void | ||
Résultat | void |
protected afterUpdate ( ) : void | ||
Résultat | void |
protected beforeDelete ( ) : void | ||
Résultat | void |
protected beforeInsert ( ) : void | ||
Résultat | void |
protected beforeSave ( ) : void | ||
Résultat | void |
protected beforeUpdate ( ) : void | ||
Résultat | void |
protected getPrimaryKey ( ) : array | ||
Résultat | array |
public getRelation ( string $modelName ) : |
||
$modelName | string | |
Résultat |
public getRelations ( string $modelName ) : array | ||
$modelName | string | |
Résultat | array |
public getTable ( ) : |
||
Résultat |
public setRelation ( |
||
$row | ||
Résultat |
public setTable ( |
||
$table | ||
Résultat | self |
protected array $clean | ||
Résultat | array |