\Pluf\WorkflowMachine

State machine system.

The Workflow component provides tools for managing a workflow or finite state machine.

Summary

Methods
Properties
Constants
transact()
apply()
can()
setStates()
setSignals()
setInitialState()
setProperty()
$states
$statePropertyName
$signals
KEY_ACTION
STATE_OTHERS
STATE_UNDEFINED
No protected methods found
No protected properties found
N/A
sendSignals()
getState()
getTransaction()
checkPreconditions()
No private properties found
N/A

Constants

KEY_ACTION

KEY_ACTION = 'action'

STATE_OTHERS

STATE_OTHERS = '*'

STATE_UNDEFINED

STATE_UNDEFINED = '#'

Properties

$states

$states : 

Type

$statePropertyName

$statePropertyName : string

Name of state property

This is a field name where state is stored in. Default is 'state'.

Type

string

$signals

$signals : 

Type

Methods

transact()

transact(\Pluf_HTTP_Request  $request, \Pluf_Model  $object, string  $action) : \Pluf\Workflow\Machine

Perform action on object

Parameters

\Pluf_HTTP_Request $request
\Pluf_Model $object
string $action

Throws

\Pluf\Exception

Returns

\Pluf\Workflow\Machine

apply()

apply(\Pluf_Model  $object, string  $action) : \Pluf\Workflow\Machine

Applies action on the object

Parameters

\Pluf_Model $object
string $action

Returns

\Pluf\Workflow\Machine

can()

can(\Pluf_Model  $object, string  $action) : boolean

Check if it is possible to perform action

Parameters

\Pluf_Model $object
string $action

Returns

boolean —

true if it is possible to apply action.

setStates()

setStates(  $states) 

Parameters

$states

setSignals()

setSignals(array  $signals) : \Pluf\Workflow\Machine

Sets list of signals

Parameters

array $signals

Returns

\Pluf\Workflow\Machine

setInitialState()

setInitialState(  $initialState) 

Parameters

$initialState

setProperty()

setProperty(  $statePropertyName) 

Parameters

$statePropertyName

sendSignals()

sendSignals(\Pluf_Model  $object, string  $action, Object  $state, Object  $transaction) 

Send signals

Parameters

\Pluf_Model $object
string $action
Object $state
Object $transaction

getState()

getState(  $object) 

Parameters

$object

getTransaction()

getTransaction(  $state,   $action) 

Parameters

$state
$action

checkPreconditions()

checkPreconditions(  $object,   $action,   $transaction) 

Parameters

$object
$action
$transaction