Class Transaction
Transaction object
A transaction is an object that is used to prepare and send a transaction to the server.
The object encapsulates:
- the collections definitions for locking
- the actual javascript function
- additional options like waitForSync, lockTimeout and params
The transaction object requires the connection object and can be initialized
with or without initial transaction configuration.
Any configuration can be set and retrieved by the object's methods like this:
$this->setAction('function (){your code};'); $this->setCollections(array('read' => 'my_read_collection, 'write' => array('col_1', 'col2')));
or like this:
$this->action('function (){your code};'); $this->collections(array('read' => 'my_read_collection, 'write' => array('col_1', 'col2')));
There are also helper functions to set collections directly, based on their locking:
$this->setWriteCollections($array or $string if single collection) $this->setReadCollections($array or $string if single collection)
Methods summary
public
|
#
__construct(
Initialise the transaction object |
public
mixed
|
|
protected
|
|
public
|
|
public
array
|
|
public
|
|
public
string
|
|
public
|
|
public
boolean
|
|
public
|
|
public
integer
|
|
public
|
|
public
array
|
|
public
|
#
setWriteCollections( array $value )
Convenience function to directly set write-collections without having to access them from the collections attribute. |
public
array
|
#
getWriteCollections( )
Convenience function to directly get write-collections without having to access them from the collections attribute. |
public
|
#
setReadCollections( array $value )
Convenience function to directly set read-collections without having to access them from the collections attribute. |
public
array
|
#
getReadCollections( )
Convenience function to directly get read-collections without having to access them from the collections attribute. |
public
|
|
public
|
|
public
mixed
|
|
public
mixed
|
|
public
boolean
|
|
public
string
|
|
public
|
Constants summary
string |
ENTRY_COLLECTIONS
Collections index |
#
'collections'
|
string |
ENTRY_ACTION
Action index |
#
'action'
|
string |
ENTRY_WAIT_FOR_SYNC
WaitForSync index |
#
'waitForSync'
|
string |
ENTRY_LOCK_TIMEOUT
Lock timeout index |
#
'lockTimeout'
|
string |
ENTRY_PARAMS
Params index |
#
'params'
|
string |
ENTRY_READ
Read index |
#
'read'
|
string |
ENTRY_WRITE
WRITE index |
#
'write'
|
Properties summary
protected
array
|
$attributes
The transaction's attributes. |
#
[]
|
protected
|
$_action
string The action property of the transaction. |
Magic properties
public
array
|
$collection
|
public
mixed
|
$readCollection
|
public
mixed
|
$writeCollection
|
public
string
|
$action
|
public
boolean
|
$waitForSync
|
public
integer
|
$lockTimeout
|