Property | Type | Description | |
---|---|---|---|
$entity_builder | the builder to get the reference to the entity. | ||
$identifier | the Identifier that uniquely identifies the statemachine | ||
$persistence_adapter | the instance for getting to the persistence layer | ||
$statemachine | Only a statemachine that uses this Context should set itself on the Context, providing a bidirectional association. |
Method | Description | |
---|---|---|
__construct ( |
Constructor | |
__toString ( ) | ||
add ( string $state, string $message = null ) : boolean | adds the state data to the persistence layer if it is not there. | |
getBuilder ( ) : |
returns the builder used to get the application domain specific model. | |
getEntity ( boolean $create_fresh_entity = false ) : mixed | Gets a (cached) reference to the application domain specific model, for example an 'Order' or 'Customer' that transitions through states in it's lifecycle. | |
getEntityId ( ) : string | gets the entity id that represents the unique identifier for the application domain specific model. | |
getId ( boolean $readable = false, boolean $with_state = false ) : string | get the unique identifier for an Context, which consists of the machine name and the entity_id in parseable form, with an optional state | |
getIdentifier ( ) : |
get the Identifier | |
getMachine ( ) : string | gets the statemachine name that handles the entity | |
getPersistenceAdapter ( ) : |
gets the Context state reader/writer. | |
getState ( ) : string | gets the state. | |
getStateMachine ( ) : |
gets the associated statemachine (if a statemachine is associated) | |
setFailedTransition ( |
stores a failed transition, called by the statemachine This is a transition that has failed since it: - was not allowed - where an exception was thrown from a rule or command - etc. any general transition failure | |
setState ( string $state, string $message = null ) : boolan | Sets the state | |
setStateMachine ( |
Provides a bidirectional association with the statemachine. | |
toString ( ) : string | get the toString representation |
public __construct ( |
||
$identifier | the identifier for the statemachine | |
$entity_builder | optional: A specific builder class to create a reference to the entity we wish to manipulate/have access to. | |
$persistence_adapter | optional: A specific reader/writer class can be used to generate different 'read/write' behaviour |
public add ( string $state, string $message = null ) : boolean | ||
$state | string | |
$message | string | optional message. this can be used by the persistence adapter to be part of the transition history to provide extra information about the transition. |
return | boolean | true if it was added, false if it was already there |
public getBuilder ( ) : |
||
return |
public getEntityId ( ) : string | ||
return | string |
public getIdentifier ( ) : |
||
return |
public getMachine ( ) : string | ||
return | string |
public getPersistenceAdapter ( ) : |
||
return | a concrete persistence adapter |
public getStateMachine ( ) : |
||
return |
public setFailedTransition ( |
||
$transition | ||
$e |
public setState ( string $state, string $message = null ) : boolan | ||
$state | string | |
$message | string | optional message. this can be used by the persistence adapter to be part of the transition history to provide extra information about the transition. |
return | boolan | true if there was never any state persisted for this machine before (just added for the first time), false otherwise |
public setStateMachine ( |
||
$statemachine |
protected EntityBuilder,izzum\statemachine $entity_builder | ||
return |
protected Identifier,izzum\statemachine $identifier | ||
return |
protected Adapter,izzum\statemachine\persistence $persistence_adapter | ||
return |