Class SWNode
This class implements a graph node for the simpleWorkflow extension.
-
CComponent
-
SWNode
Methods summary
public
|
#
__construct( mixed $node, string $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() )
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() )
Parameters
- $node
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 :
<pre> { 'id' => string, // mandatory 'label' => string , // optional
'constraint' => string, // optional 'transition' => array, // optional
'metadata' => array, // optional } </pre> 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.
- $defaultWorkflowId
string defaultWorkflowId workflow Id that is used each time a workflow is needed to
complete a status name.
|
public
array
|
#
parseNodeId( string $status, mixed $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 :
- ready : matches
- to_process : matches
- priority1 : matches
- 2_level : does not match
- to-production : does not match
- enable/disable : does not match
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 :
- ready : matches
- to_process : matches
- priority1 : matches
- 2_level : does not match
- to-production : does not match
- enable/disable : does not match
Parameters
- $status
string status status name (wfId/nodeId or nodeId)
- $workflowId
Returns
array the complete status (e.g array ( [workflow] => 'a' [node] => 'b' ))
|
public
|
#
__get( mixed $name )
Overrides the default magic method defined at the CComponent level in order
to return a metadata value if parent method fails.
Overrides the default magic method defined at the CComponent level in order
to return a metadata value if parent method fails.
See
CComponent::__get()
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
getTransitionTask( mixed $endNode )
Parameters
- $endNode
mixed $endNode SWNode instance or string that will be converted to SWNode instance
(e.g 'workflowId/nodeId')
Throws
Returns
String the task for this transition or NULL if no task is defined
|
public
|
|
public
|
|
public
|
#
equals( mixed $status )
SWnode comparator method. Note that only the node and the workflow id members
are compared.
SWnode comparator method. Note that only the node and the workflow id members
are compared.
Parameters
- $status
mixed SWNode object or string. If a string is provided it is used to create a new
SWNode object.
|
Magic methods summary