PHP Class Gajus\MOA\Mother

Inheritance: implements ArrayAccess, implements Psr\Log\LoggerAwareInterface
Afficher le fichier Open project: gajus/moa

Protected Properties

Свойство Type Description
$data
$db
$logger

Méthodes publiques

Méthode 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

Méthodes protégées

Méthode 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.

Private Methods

Méthode Description
synchronise ( ) : void Use the primary key to update object instance with the data from the database.

Method Details

__construct() public méthode

public __construct ( PDO $db, integer $id = null )
$db PDO
$id integer

afterDelete() protected méthode

Triggered after DELETE query but before the transaction is committed.
protected afterDelete ( ) : void
Résultat void

afterInsert() protected méthode

Triggered after INSERT query but before the transaction is committed.
protected afterInsert ( ) : void
Résultat void

afterUpdate() protected méthode

Triggered after UPDATE query but before the transaction is committed.
protected afterUpdate ( ) : void
Résultat void

delete() public méthode

Delete object from the database. Deleted object retains its data except for the primary key value.
public delete ( )

get() public méthode

Get object property.
public get ( string $name ) : mixed
$name string Property name.
Résultat mixed

getData() public méthode

Get object data in an associative array.
public getData ( ) : array
Résultat array

getDatabaseHandle() public méthode

Get database handle used to instantiate the object.
public getDatabaseHandle ( ) : PDO
Résultat PDO

getRequiredProperties() public méthode

Properties that are not nullable and do not have a default value.
public getRequiredProperties ( ) : array
Résultat array

getSynchronisationCount() public méthode

This method must not be used in the application code.
public getSynchronisationCount ( ) : integer
Résultat integer

offsetExists() public méthode

public offsetExists ( mixed $offset ) : boolean
$offset mixed
Résultat boolean

offsetGet() public méthode

public offsetGet ( mixed $offset ) : mixed
$offset mixed
Résultat mixed

offsetSet() public méthode

public offsetSet ( mixed $offset, $value ) : void
$offset mixed
Résultat void

offsetUnset() public méthode

public offsetUnset ( mixed $offset ) : void
$offset mixed
Résultat void

populate() public méthode

Shorthand method to pass each array key, value pair to the setter.
public populate ( array $data ) : Gajus\MOA\Mother
$data array
Résultat Gajus\MOA\Mother

save() public méthode

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.
public save ( )

set() public méthode

Set object property.
public set ( string $name, mixed $value = null ) : boolean
$name string Property name.
$value mixed
Résultat boolean Returns true if object state has been affected.

setLogger() public méthode

Sets a logger instance on the object
public setLogger ( Psr\Log\LoggerInterface $logger ) : null
$logger Psr\Log\LoggerInterface
Résultat null

validateSave() protected méthode

Returning an error message will discard the transaction and throw Gajus\MOA\Exception\ValidationException exception.
protected validateSave ( ) : null | mixed
Résultat null | mixed

validateSet() protected méthode

Returning an error message will discard the transaction and throw Gajus\MOA\Exception\ValidationException exception.
protected validateSet ( string $name, mixed $value ) : null | string
$name string
$value mixed
Résultat null | string

Property Details

$data protected_oe property

protected $data

$db protected_oe property

protected $db

$logger protected_oe property

protected $logger