PHP Класс Gajus\MOA\Mother

Наследование: implements ArrayAccess, implements Psr\Log\LoggerAwareInterface
Показать файл Открыть проект

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

Свойство Тип Описание
$data
$db
$logger

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

Метод Описание
__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

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

Метод Описание
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.

Приватные методы

Метод Описание
synchronise ( ) : void Use the primary key to update object instance with the data from the database.

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

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

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

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

Triggered after DELETE query but before the transaction is committed.
protected afterDelete ( ) : void
Результат void

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

Triggered after INSERT query but before the transaction is committed.
protected afterInsert ( ) : void
Результат void

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

Triggered after UPDATE query but before the transaction is committed.
protected afterUpdate ( ) : void
Результат void

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

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

get() публичный Метод

Get object property.
public get ( string $name ) : mixed
$name string Property name.
Результат mixed

getData() публичный Метод

Get object data in an associative array.
public getData ( ) : array
Результат array

getDatabaseHandle() публичный Метод

Get database handle used to instantiate the object.
public getDatabaseHandle ( ) : PDO
Результат PDO

getRequiredProperties() публичный Метод

Properties that are not nullable and do not have a default value.
public getRequiredProperties ( ) : array
Результат array

getSynchronisationCount() публичный Метод

This method must not be used in the application code.
public getSynchronisationCount ( ) : integer
Результат integer

offsetExists() публичный Метод

public offsetExists ( mixed $offset ) : boolean
$offset mixed
Результат boolean

offsetGet() публичный Метод

public offsetGet ( mixed $offset ) : mixed
$offset mixed
Результат mixed

offsetSet() публичный Метод

public offsetSet ( mixed $offset, $value ) : void
$offset mixed
Результат void

offsetUnset() публичный Метод

public offsetUnset ( mixed $offset ) : void
$offset mixed
Результат void

populate() публичный Метод

Shorthand method to pass each array key, value pair to the setter.
public populate ( array $data ) : Gajus\MOA\Mother
$data array
Результат Gajus\MOA\Mother

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

set() публичный Метод

Set object property.
public set ( string $name, mixed $value = null ) : boolean
$name string Property name.
$value mixed
Результат boolean Returns true if object state has been affected.

setLogger() публичный Метод

Sets a logger instance on the object
public setLogger ( Psr\Log\LoggerInterface $logger ) : null
$logger Psr\Log\LoggerInterface
Результат null

validateSave() защищенный Метод

Returning an error message will discard the transaction and throw Gajus\MOA\Exception\ValidationException exception.
protected validateSave ( ) : null | mixed
Результат null | mixed

validateSet() защищенный Метод

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
Результат null | string

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

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

protected $data

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

protected $db

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

protected $logger