phpDocumentor

DataObserverRegistry
in package

Class DataObserverRegistry

Gambio data observer facade, provides access to the core operations involved in informing Hub for data changes.

Example:

DataObserverRegistry::activate(); ... DataObserverRegistry::inserted('order', $newOrderId);

The registry will delegate all changes to Hub at the end of the script execution automatically.

Tags
subpackage

GambioHub

Table of Contents

$activated  : bool
$observers  : array<string|int, mixed>
$subjects  : array<string|int, mixed>
activate()  : mixed
Activates the data observer registry.
deleted()  : mixed
Record data removal.
inserted()  : mixed
Record data insertion.
process()  : mixed
Process all recorded changes and delegate them to Hub.
updated()  : mixed
Record data modification.
change()  : mixed
Delegate a data change in the correct subject.
resolve()  : array<string|int, mixed>|bool|DataChangeCollection
startSession()  : string
Start a new Hub session.

Properties

Methods

activate()

Activates the data observer registry.

public static activate() : mixed

This method will enable the recording and delegation of data changes.

Return values
mixed

deleted()

Record data removal.

public static deleted(string $subject, int $rowId) : mixed

Call this method with the appropriate subject and pass the inserted row ID.

Parameters
$subject : string

Subject codename.

$rowId : int

Removed row ID.

Return values
mixed

inserted()

Record data insertion.

public static inserted(string $subject, int $rowId) : mixed

Call this method with the appropriate subject and pass the inserted row ID.

Parameters
$subject : string

Subject codename.

$rowId : int

Inserted row ID.

Return values
mixed

process()

Process all recorded changes and delegate them to Hub.

public static process() : mixed

Once the "activate" method is called, this method is being set to run at the end of the script execution.

Return values
mixed

updated()

Record data modification.

public static updated(string $subject, int $rowId) : mixed

Call this method with the appropriate subject and pass the inserted row ID.

Parameters
$subject : string

Subject codename.

$rowId : int

Updated row ID.

Return values
mixed

change()

Delegate a data change in the correct subject.

protected static change(string $subject, string $action, int $rowId) : mixed

The correct subject observers will be eventually notified.

Parameters
$subject : string

Subject codename.

$action : string

Executed action, provide 'insert', 'update' or 'delete'.

$rowId : int

Changed row ID.

Return values
mixed

startSession()

Start a new Hub session.

protected static startSession() : string

Use this method to create a new Hub session, in case there is non available to use.

Return values
string

Search results