Another newbie situation
I get an
exception on resume(). It is noted in following code as a comment. The
classes PrintTrue and PrintFalse exist, code also below. As expected, the
workflow suspends ... waiting for input. But when provided the input via
resume(), it throws exception ...
Understanding this will probably get me on the
path to hvaing a clue
Any help greatly appreciated.
<?php
require_once
'lib/ezComponents/Base/src/base.php ';
require_once
'lib/ezComponents/Database/src/factory.php
';
require_once
'PrintTrue.php';
require_once
'PrintFalse.php';
function __autoload ( $className )
{
ezcBase :: autoload (
$className );
}
$dbparams = array(
'type' => 'mysql',
'dbname' => 'wflow',
'user' => 'root',
'pass' => 'password' );
$workflow
= new ezcWorkflow('Test');
$input
= new ezcWorkflowNodeInput(array ('choice' => new
ezcWorkflowConditionIsBool));
$workflow
->startNode->addOutNode($input);
$true
= new ezcWorkflowNodeAction('PrintTrue');
$false
= new ezcWorkflowNodeAction('PrintFalse');
$branch
= new ezcWorkflowNodeExclusiveChoice();
$branch
->addConditionalOutNode(new ezcWorkflowConditionIsTrue('choice'),$true);
$branch
->addConditionalOutNode(new ezcWorkflowConditionIsFalse('choice'),$false);
$input
->addOutNode($branch);
$merge
= new ezcWorkflowNodeSimpleMerge();
$merge
->addInNode($true)->addInNode($false)->addOutNode($workflow->endNode);
$db
= ezcDbFactory::create($dbparams);
$definition
= new ezcWorkflowDatabaseDefinitionStorage($db);
$definition
->save($workflow);
$execute
= new ezcWorkflowDatabaseExecution($db);
$execute
->workflow = $workflow;
$executionId
= $execute->start();
$execute
= new ezcWorkflowDatabaseExecution($db, $executionId);
// Throws following exception at the resume() ...
ezcWorkflowExecutionException: Node activates less conditional outgoing nodes
than required.
$execute
->resume(array('choice'
=>true));
______________________________________
*** PrintTrue class
?>
class
PrintTrue implements ezcWorkflowServiceObject
{
private $whatToSay;
public function __construct(){
$this->whatToSay = 'true';
}
public function execute(ezcWorkflowExecution
$execute) {
echo
$this->whatToSay;
return true;
}
public function __toString(){
return 'action description';
}
}
?>
**** PrintFalse class
<?php
class
PrintFalse implements ezcWorkflowServiceObject
{
private $whatToSay;
public function __construct(){
$this->whatToSay = 'false';
}
public function execute(ezcWorkflowExecution
$execute) {
echo
$this->whatToSay;
return true;
}
public function __toString(){
return 'action description';
}
}
?>