simpleWorkflow
  • Class
  • Tree

Classes

  • SWActiveRecord
  • SWActiveRecordBehavior
  • SWComponent
  • SWEvent
  • SWException
  • SWHelper
  • SWNode
  • SWPhpWorkflowSource
  • SWValidator
  • SWWorkflowSource
  • SWyEdConverter
  • SWyEdConverterDOM

Class SWWorkflowSource

This is the base class for all workflow source implementations. It provides basic initialization features and a set of methods that must be implemented by workflow source classes.

CApplicationComponent
Extended by SWWorkflowSource

Direct known subclasses

SWPhpWorkflowSource

Abstract
Located at SWWorkflowSource.php

Methods summary

public SWNode
# createSWNode( mixed $node, mixed $workflowId )

Create and returns a SWNode object. The SWNode returned doesn't have to be defined in a workflow currently loaded.
If $node is a string, it can be a fully qualified node id (e.g workflowId/NodeId) or only a nodeId, but in this case, argument $workflowId must contain the id of the workflow to use.
If $node is a SWNode object, then it is returned with no modification.

Create and returns a SWNode object. The SWNode returned doesn't have to be defined in a workflow currently loaded.
If $node is a string, it can be a fully qualified node id (e.g workflowId/NodeId) or only a nodeId, but in this case, argument $workflowId must contain the id of the workflow to use.
If $node is a SWNode object, then it is returned with no modification.

Returns

SWNode
the node object
abstract public
# addWorkflow( array $definition, string $id )

Add a workflow to the internal workflow collection. The definition of the workflow to add is provided in the $definition argument as an associative array. This method is used for instance when a workflow definition is provided by a model and not by a php file or another source. If a workflow with the same id is already loaded, it is not over written.

Add a workflow to the internal workflow collection. The definition of the workflow to add is provided in the $definition argument as an associative array. This method is used for instance when a workflow definition is provided by a model and not by a php file or another source. If a workflow with the same id is already loaded, it is not over written.

Parameters

$definition
array
$definition workflow definition
$id
string
$id unique id for the workflow to add
abstract public
# loadWorkflow( string $workflowId, boolean $forceReload = false )

Loads the workflow whose id is passed as argument from the source. If it was already loaded, then it is not reloaded unles $forceReload is set to TRUE. If the workflow could not be found, an exception is thrown.

Loads the workflow whose id is passed as argument from the source. If it was already loaded, then it is not reloaded unles $forceReload is set to TRUE. If the workflow could not be found, an exception is thrown.

Parameters

$workflowId
string
$workflowId the id of the workflow to load
$forceReload
boolean
$forceReload force workflow reload
abstract public SWNode
# getNodeDefinition( mixed $node, mixed $defaultWorkflowId = null )

Search for the node passed as argument in the workflow definition. Note that if this node is not found among the currently loaded workflows, this method will try to load the workflow it belongs to.

Search for the node passed as argument in the workflow definition. Note that if this node is not found among the currently loaded workflows, this method will try to load the workflow it belongs to.

Parameters

$node
mixed
node String or SWNode object to look for
$defaultWorkflowId

Returns

SWNode
the node as it is defined in a workflow, or NULL if not found
abstract public array
# getNextNodes( mixed $sourceNode, mixed $workflowId = null )

Returns an array containing all SWNode object for each status that can be reached from $startStatus. It does not evaluate node constraint but only the fact that a transition exist beteween $startStatus and nodes returned. If no nodes are found, an empty array is returned. An exception is thrown if $startStatus is not found among all worklows available.

Returns an array containing all SWNode object for each status that can be reached from $startStatus. It does not evaluate node constraint but only the fact that a transition exist beteween $startStatus and nodes returned. If no nodes are found, an empty array is returned. An exception is thrown if $startStatus is not found among all worklows available.

Returns

array
SWNode array
abstract public boolean
# isNextNode( mixed $sourceNode, mixed $targetNode, mixed $workflowId = null )

Checks if there is a transition between the two nodes passed as argument.

Checks if there is a transition between the two nodes passed as argument.

Parameters

$sourceNode
mixed
$sourceNode can be provided as a SWNode object, or as a string that can contain a workflowId or not.
$targetNode
mixed
$targetNode target node to test
$workflowId

Returns

boolean
true if $nextStatus can be reached from $startStatus
abstract public SWnode
# getInitialNode( mixed $workflowId )

Returns the initial node defined for the workflow whose id is passed as argument. A valid workflow must have one and only one initial status. If it's note the case, workflow can't be loaded.

Returns the initial node defined for the workflow whose id is passed as argument. A valid workflow must have one and only one initial status. If it's note the case, workflow can't be loaded.

Returns

SWnode
initial node for $workflowId
abstract public array
# getAllNodes( string $workflowId )

Fetch all nodes belonging to the workflow whose Id is passed as argument.

Fetch all nodes belonging to the workflow whose Id is passed as argument.

Parameters

$workflowId
string
$workflowId id of the workflow that owns all nodes returned

Returns

array
all nodes belonging to workflow $workflowId

Magic methods summary

Properties summary

public array $preload
#

list of workflow names that shoumd ne loaded when the component is initialized

list of workflow names that shoumd ne loaded when the component is initialized

public string $workflowNamePrefix
#

when a workflow name is automatically built from the model name, this prefix is added to the model name so to avoid clashes (e.g. model 'MyModel' is by default inserted into workflow 'swMyModel')

when a workflow name is automatically built from the model name, this prefix is added to the model name so to avoid clashes (e.g. model 'MyModel' is by default inserted into workflow 'swMyModel')

simpleWorkflow API documentation generated by ApiGen 2.8.0