PHP Class ezcWorkflowNodeSimpleMerge, Workflow
The Simple Merge workflow pattern is to be used to merge the possible paths that are defined
by a preceding Exclusive Choice. It is assumed that of these possible paths exactly one is
taken and no synchronization takes place.
Use Case Example: After the payment has been performed by either credit card or bank
transfer, the order can be processed further.
Incoming nodes: 2..*
Outgoing nodes: 1
This example displays how you can use a simple merge to tie together two different
execution paths from an exclusive choice into one.
new ezcWorkflowConditionIsInt ) );
$workflow->startNode->addOutNode( $input );
create the exclusive choice branching node
$choice = new ezcWorkflowNodeExclusiveChoice;
$intput->addOutNode( $choice );
$branch1 = ....; // create nodes for the first branch of execution here..
$branch2 = ....; // create nodes for the second branch of execution here..
add the outnodes and set the conditions on the exclusive choice
$choice->addConditionalOutNode( new ezcWorkflowConditionVariable( 'value',
new ezcWorkflowConditionGreatherThan( 10 ) ),
$branch1 );
$choice->addConditionalOutNode( new ezcWorkflowConditionVariable( 'value',
new ezcWorkflowConditionLessThan( 11 ) ),
$branch2 );
Merge the two branches together and continue execution.
$merge = new ezcWorkflowNodeSimpleMerge();
$merge->addInNode( $branch1 );
$merge->addInNode( $branch2 );
$merge->addOutNode( $workflow->endNode );
?>
Datei anzeigen
Open project: zetacomponents/workflow
Class Usage Examples
Public Methods
Method |
Description |
|
activate ( ezcWorkflowExecution $execution, ezcWorkflowNode $activatedFrom = null, integer $threadId ) |
Activate this node. |
|
execute ( ezcWorkflowExecution $execution ) : boolean |
Executes this node. |
|
Method Details
public activate ( ezcWorkflowExecution $execution, ezcWorkflowNode $activatedFrom = null, integer $threadId ) |
$execution |
ezcWorkflowExecution |
|
$activatedFrom |
ezcWorkflowNode |
|
$threadId |
integer |
|
public execute ( ezcWorkflowExecution $execution ) : boolean |
$execution |
ezcWorkflowExecution |
|
return |
boolean |
true when the node finished execution,
and false otherwise |