Property | Type | Description | |
---|---|---|---|
$dns | string | the data source name for a mongo connection | |
$driver_options | array | the php driver specific options | |
$options | array | connection options |
Method | Description | |
---|---|---|
__construct ( string $dns = 'mongodb://localhost:27017', array $options = ["connect" => true], array $driver_options = [] ) | constructor. a connection to mongodb via the mongoclient will be lazily created. | |
__toString ( ) | ||
getClient ( ) : MongoClient | Gets a lazy loaded \MongoClient instance. | |
getEntityIds ( $machine, $state = null ) | {@inheritDoc} | |
isPersisted ( |
{@inheritDoc} | |
load ( |
{@inheritDoc} Load the statemachine via a document in a mongodb collection. | |
processGetState ( |
{@inheritDoc} | |
setClient ( MongoClient $client ) | sets a mongoclient. this can be useful if your application already has a mongoclient instantiated and you want to reuse it. | |
toString ( ) |
Method | Description | |
---|---|---|
addHistory ( |
{@inheritDoc} | |
checkAndCreateIndexesIfNecessary ( number $check_index_once_in = 1000 ) | since we do not want to burden a client of this code with the responsiblity of creating indexes, we take a statistical approach to check if we need to create an index in the background. This will only be done once. | |
createIndexes ( ) | create indexes in the background for the collections used. this will only be done by mongo if they do not exist already. | |
insertState ( |
{@inheritDoc} | |
onConnect ( ) | A hook to use in a subclass. | |
updateState ( |
{@inheritDoc} |
public __construct ( string $dns = 'mongodb://localhost:27017', array $options = ["connect" => true], array $driver_options = [] ) | ||
$dns | string | the data source name. mongodb://[username:password@]host1[:port1][,host2[:port2:],...] |
$options | array | server options (usable for authentication, replicasets etc) |
$driver_options | array | php specifif driver options |
protected addHistory ( |
||
$identifier |
protected checkAndCreateIndexesIfNecessary ( number $check_index_once_in = 1000 ) | ||
$check_index_once_in | number | check for index creation. on average, every |
protected createIndexes ( ) |
public getClient ( ) : MongoClient | ||
return | MongoClient |
protected insertState ( |
||
$identifier |
public isPersisted ( |
||
$identifier |
public load ( |
||
$statemachine |
public processGetState ( |
||
$identifier |
public setClient ( MongoClient $client ) | ||
$client | MongoClient |
protected updateState ( |
||
$identifier |
protected string $dns | ||
return | string |
protected array $driver_options | ||
return | array |