public function start($parentId = null)
{
if ($this->workflow === null) {
throw new ezcWorkflowExecutionException('No workflow has been set up for execution.');
}
$this->cancelled = false;
$this->ended = false;
$this->resumed = false;
$this->suspended = false;
$this->doStart($parentId);
$this->loadFromVariableHandlers();
foreach ($this->plugins as $plugin) {
$plugin->afterExecutionStarted($this);
}
// Start workflow execution by activating the start node.
$this->workflow->startNode->activate($this);
// Continue workflow execution until there are no more
// activated nodes.
$this->execute();
// Return execution ID if the workflow has been suspended.
if ($this->isSuspended()) {
return (int) $this->id;
}
}