Property | Type | Description | |
---|---|---|---|
$data | |||
$db | |||
$logger |
Method | Description | |
---|---|---|
__construct ( PDO $db, integer $id = null ) | ||
delete ( ) | Delete object from the database. Deleted object retains its data except for the primary key value. | |
get ( string $name ) : mixed | Get object property. | |
getData ( ) : array | Get object data in an associative array. | |
getDatabaseHandle ( ) : PDO | Get database handle used to instantiate the object. | |
getRequiredProperties ( ) : array | Properties that are not nullable and do not have a default value. | |
getSynchronisationCount ( ) : integer | Synchronisation count is used for unit testing only. | |
offsetExists ( mixed $offset ) : boolean | ||
offsetGet ( mixed $offset ) : mixed | ||
offsetSet ( mixed $offset, $value ) : void | ||
offsetUnset ( mixed $offset ) : void | ||
populate ( array $data ) : Gajus\MOA\Mother | Shorthand method to pass each array key, value pair to the setter. | |
save ( ) | Save the object to the database. Depending on whether object's primary key is set this method will either attempt to insert the object to the database or update an existing entry. | |
set ( string $name, mixed $value = null ) : boolean | Set object property. | |
setLogger ( Psr\Log\LoggerInterface $logger ) : null | Sets a logger instance on the object |
Method | Description | |
---|---|---|
afterDelete ( ) : void | Triggered after DELETE query but before the transaction is committed. | |
afterInsert ( ) : void | Triggered after INSERT query but before the transaction is committed. | |
afterUpdate ( ) : void | Triggered after UPDATE query but before the transaction is committed. | |
validateSave ( ) : null | mixed | Triggered when an attempt is made to save object state. | |
validateSet ( string $name, mixed $value ) : null | string | Triggered when an attempt is made to change object property. |
Method | Description | |
---|---|---|
synchronise ( ) : void | Use the primary key to update object instance with the data from the database. |
protected afterDelete ( ) : void | ||
return | void |
protected afterInsert ( ) : void | ||
return | void |
protected afterUpdate ( ) : void | ||
return | void |
public delete ( ) |
public getDatabaseHandle ( ) : PDO | ||
return | PDO |
public getRequiredProperties ( ) : array | ||
return | array |
public getSynchronisationCount ( ) : integer | ||
return | integer |
public offsetExists ( mixed $offset ) : boolean | ||
$offset | mixed | |
return | boolean |
public save ( ) |
protected validateSave ( ) : null | mixed | ||
return | null | mixed |