PHP Класс 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 );
?>
Показать файл
Открыть проект
Примеры использования класса
Открытые методы
Метод |
Описание |
|
__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. |
|
Защищенные методы
Метод |
Описание |
|
createObject ( ) : ezcWorkflowServiceObject |
Returns the service object as specified by the configuration. |
|
Описание методов
__construct()
публичный Метод
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()
публичный Метод
Returns a textual representation of this node.
configurationFromXML()
публичный статический Метод
Generate node configuration from XML representation.
configurationToXML()
публичный Метод
Generate XML representation of this node's configuration.
createObject()
защищенный Метод
Returns the service object as specified by the configuration.
protected createObject ( ) : ezcWorkflowServiceObject |
Результат |
ezcWorkflowServiceObject |
|
execute()
публичный Метод
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 |
|
Результат |
boolean |
true when the node finished execution,
and false otherwise |