PHP Class ezcWorkflowNodeAction, Workflow
When the node is reached during execution of the workflow, the business logic that is implemented
by the associated service object is executed.
Service objects can return true to resume execution of the
workflow or false to suspend the workflow (unless there are other active nodes)
and be re-executed later
Incoming nodes: 1
Outgoing nodes: 1
The following example displays how to create a workflow with a very
simple service object that prints the argument it was given to the
constructor:
whatToSay = $whatToSay;
}
public function execute( ezcWorkflowExecution $execution )
{
print $this->whatToSay;
return true; // we're finished, activate next node
}
public function __toString()
{
return 'action description';
}
}
$workflow = new ezcWorkflow( 'Test' );
$action = new ezcWorkflowNodeAction( array( "class" => "MyPrintAction",
"arguments" => "No. 1 The larch!" ) );
$action->addOutNode( $workflow->endNode );
$workflow->startNode->addOutNode( $action );
?>
Datei anzeigen
Open project: zetacomponents/workflow
Class Usage Examples
Public Methods
Method |
Description |
|
__construct ( mixed $configuration ) |
Constructs a new action node with the configuration $configuration. |
|
__toString ( ) : string |
Returns a textual representation of this node. |
|
configurationFromXML ( DOMElement $element ) : array |
Generate node configuration from XML representation. |
|
configurationToXML ( DOMElement $element ) |
Generate XML representation of this node's configuration. |
|
execute ( ezcWorkflowExecution $execution ) : boolean |
Executes this node by creating the service object and calling its execute() method. |
|
Protected Methods
Method |
Description |
|
createObject ( ) : ezcWorkflowServiceObject |
Returns the service object as specified by the configuration. |
|
Method Details
__construct()
public method
Configuration format
-
String:
The class name of the service object. Must implement ezcWorkflowServiceObject. No
arguments are passed to the constructor.
-
Array:
- class: The class name of the service object. Must implement ezcWorkflowServiceObject.
- arguments: Array of values that are passed to the constructor of the service object.
-
__toString()
public method
Returns a textual representation of this node.
configurationFromXML()
public static method
Generate node configuration from XML representation.
configurationToXML()
public method
Generate XML representation of this node's configuration.
createObject()
protected method
Returns the service object as specified by the configuration.
protected createObject ( ) : ezcWorkflowServiceObject |
return |
ezcWorkflowServiceObject |
|
If the service object returns true, the output node will be activated.
If the service node returns false the workflow will be suspended
unless there are other activated nodes. An action node suspended this way
will be executed again the next time the workflow is resumed.
public execute ( ezcWorkflowExecution $execution ) : boolean |
$execution |
ezcWorkflowExecution |
|
return |
boolean |
true when the node finished execution,
and false otherwise |