A simple workflow behavior for Yii ActiveRecord
|
Public Member Functions | |
__construct ($node, $defaultWorkflowId=null) | |
parseNodeId ($status, $workflowId) | |
__get ($name) | |
getWorkflowId () | |
getId () | |
getLabel () | |
getNext () | |
getConstraint () | |
getMetadata () | |
getNextNodeIds () | |
getTransitionTask ($endNode) | |
__toString () | |
toString () | |
equals ($status) | |
This class implements a graph node for the simpleWorkflow extension.
__construct | ( | $node, | |
$defaultWorkflowId = null |
|||
) |
Creates a workflow node instance. If no workflowId is specified in the nodeId, then the $defaultWorkflowId is used.
Note that both workflow and node id must begin with a alphabetic character followed by aplha-numeric characters : all other characters are not accepted and cause an exception to be thrown (see SWNode::parseNodeId())
mixed | $node | If a string is passed as argument, it can be both in format workflowId/NodeId or simply 'nodeId'. In this last case, argument $defaultWorkflowIs must be provided, otherwise it is ignored. The $node argument may also be provided as an associative array, with the following structure : { 'id' => string, // mandatory 'label' => string , // optional 'constraint' => string, // optional 'transition' => array, // optional 'metadata' => array, // optional }Again, the 'id' value may contain a workflow id (e.g 'workflowId/nodeId') but if it's not the case then the second argument $defaultWorkflowId must be provided. |
string | defaultWorkflowId workflow Id that is used each time a workflow is needed to complete a status name. |
__get | ( | $name) |
Overrides the default magic method defined at the CComponent level in order to return a metadata value if parent method fails.
__toString | ( | ) |
equals | ( | $status) |
getConstraint | ( | ) |
getId | ( | ) |
getLabel | ( | ) |
getMetadata | ( | ) |
getNext | ( | ) |
getNextNodeIds | ( | ) |
getTransitionTask | ( | $endNode) |
mixed | $endNode | SWNode instance or string that will be converted to SWNode instance (e.g 'workflowId/nodeId') |
SWException |
getWorkflowId | ( | ) |
parseNodeId | ( | $status, | |
$workflowId | |||
) |
Parse a status name and return it as an array. The string passed as argument may be a complete status name (e.g workflowId/nodeId) and if no workflowId is specified, then an exception is thrown. Both workflow and node ids must match following pattern:
/^[[:alpha:]][[:alnum:]_]*$/
For instance :
string | status status name (wfId/nodeId or nodeId) |
toString | ( | ) |