Simple state machine for typical CRUD entities accessed via Flupdo.
Configuration Schema
The state machine is configured using JSON object passed to the constructor (the $config
parameter). The object must match the following JSON schema (JSON format):
|
| initializeMachine ($config) |
| Define state machine used by all instances of this type. More...
|
|
| setupDefaultMachine ($config) |
| Setup basic CRUD machine. More...
|
|
| create (Reference $ref, $properties) |
| Create. More...
|
|
| edit (Reference $ref, $properties) |
| Edit. More...
|
|
| delete (Reference $ref) |
| Delete. More...
|
|
| recalculateTree () |
| Recalculate nested-sets tree indices. More...
|
|
| initializeMachine ($config) |
| Define state machine used by all instances of this type. More...
|
|
| scanTableColumns () |
| Scan table in database and populate properties. More...
|
|
| checkAccessPolicy ($access_policy_name, Reference $ref) |
| Returns true if user has required access_policy. More...
|
|
| queryAddAccessPolicyCondition ($access_policy_name, $query) |
| Adds conditions to enforce read access_policy to query object. More...
|
|
| queryAddFrom ($query) |
| Add FROM clause. More...
|
|
| queryGetThisTable ($query) |
| Get table name with alias. More...
|
|
| queryAddStateSelect ($query) |
| Add state column into select clause of the $query. More...
|
|
| queryAddPropertiesSelect ($query) |
| Add properties to select. More...
|
|
| queryAddPrimaryKeyWhere ($query, $id, $clause= 'where') |
| Add primary key condition to where clause. More...
|
|
| initializeMachine ($config) |
| Define state machine used by all instances of this type. More...
|
|
| setupDefaultMachine ($config) |
| Setup default machine when initializeMachine is finished. More...
|
|
| initializeMachineConfig ($config, $keys) |
| Merge $config into state machine member variables. More...
|
|
| checkAccessPolicy ($access_policy, Reference $ref) |
| Returns true if user has required access_policy to invoke a transition, which requires given access_policy. More...
|
|
| getContext ($resource_name=null) |
| Get context object (whatever it is). More...
|
|
| urlFormat ($id, $url_fmt, $properties_cache) |
| Create URL using properties and given format. More...
|
|
| resolveMachineReference ($reference_name, $properties_cache) |
| Helper function to resolve reference to another machine. More...
|
|
| onStateChanged (Reference $ref, $old_state, $transition_name, $new_state) |
| Called when state is changed, when transition invocation is completed. More...
|
|
| exportDotRenderExtras ($debug_opts) |
| Render extra diagram features. More...
|
|
|
| invokeTransition (Reference $ref, $transition_name, $args, &$returns, callable $new_id_callback=null) |
| Invoke state machine transition. More...
|
|
| createListing ($filters, $filtering_flags=0) |
| Create generic listing on this machine type. More...
|
|
| createQueryBuilder () |
| Create query builder. More...
|
|
| getState ($id) |
| Get current state of state machine. More...
|
|
| getProperties ($id, &$state_cache=null) |
| Get all properties of state machine, including it's state. More...
|
|
| encodeProperties ($properties) |
| Encode properties to database representation. More...
|
|
| decodeProperties ($properties) |
| Decode properties from database representation. More...
|
|
| describeId () |
| Reflection: Describe ID (primary key). More...
|
|
| __construct (AbstractBackend $backend, $type, $config, $context) |
| Constructor. More...
|
|
| getState ($id) |
| Get current state of state machine. More...
|
|
| getProperties ($id, &$state_cache=null) |
| Get properties of state machine, including it's state. More...
|
|
| getView ($id, $view, &$properties_cache=null, &$view_cache=null, &$persistent_view_cache=null) |
| Get properties in given view. More...
|
|
| isTransitionAllowed (Reference $ref, $transition_name, $state=null) |
| Returns true if transition can be invoked right now. More...
|
|
| getAvailableTransitions (Reference $ref, $state=null) |
| Get list of all available actions for state machine instance identified by $id. More...
|
|
| invokeTransition (Reference $ref, $transition_name, $args, &$returns, callable $new_id_callback=null) |
| Invoke state machine transition. More...
|
|
| getMachineType () |
| Get type of this machine. More...
|
|
| getBackend () |
| Get backend which owns this machine. More...
|
|
| ref ($id) |
| Helper to create Reference to this machine. More...
|
|
| nullRef () |
| Helper to create null Reference to this machine. More...
|
|
| hotRef ($properties) |
| Create pre-heated reference using properties loaded from elsewhere. More...
|
|
| performSelfCheck () |
| Perform self-check. More...
|
|
| describeId () |
| Reflection: Describe ID (primary key). More...
|
|
| getUrlFormat () |
| Get URL format. More...
|
|
| getParentUrlFormat () |
| Get prent URL format. More...
|
|
| getPostActionUrlFormat () |
| Get URL for redirect-after-post. More...
|
|
| getMachineImplementationMTime () |
| Get mtime of machine implementation. More...
|
|
| getAllMachineStates ($having_section=null) |
| Reflection: Get all states. More...
|
|
| describeMachineState ($state, $field=null) |
| Reflection: Describe given machine state. More...
|
|
| describeAllMachineStates ($having_section=null) |
| Reflection: Describe all states. More...
|
|
| getAllMachineActions ($having_section=null) |
| Reflection: Get all actions (transitions) More...
|
|
| describeMachineAction ($action, $field=null) |
| Reflection: Describe given machine action (transition) More...
|
|
| describeAllMachineActions ($having_section=null) |
| Reflection: Describe all actions (transitions) More...
|
|
| getAllMachineProperties ($having_section=null) |
| Reflection: Get all properties. More...
|
|
| describeMachineProperty ($property, $field=null) |
| Reflection: Describe given property. More...
|
|
| describeAllMachineProperties ($having_section=null) |
| Reflection: Describe all properties. More...
|
|
| getAllMachineViews ($having_section=null) |
| Reflection: Get all views. More...
|
|
| describeMachineView ($view, $field=null) |
| Reflection: Describe given view. More...
|
|
| describeAllMachineViews ($having_section=null) |
| Reflection: Describe all views. More...
|
|
| getAllMachineReferences ($having_section=null) |
| Reflection: Get all references. More...
|
|
| describeMachineReference ($reference, $field=null) |
| Reflection: Describe given reference. More...
|
|
| describeAllMachineReferences ($having_section=null) |
| Reflection: Describe all references. More...
|
|
| exportDot ($debug_opts=false) |
| Export state machine to Graphviz source code. More...
|
|
static | exportDotIdentifier ($str, $prefix= 's_') |
| Convert state machine state name or group name to a safe dot identifier. More...
|
|
const | RETURNS_VALUE = null |
| Return value of invoked transition is just some value. More...
|
|
const | RETURNS_NEW_ID = 'new_id' |
| Return value of invoked transition is new ID of the state machine. More...
|
|