ezcWorkflowExecution::start PHP Method

start() public method

$parentId is used to specify the execution id of the parent workflow when executing subworkflows. It should not be used when manually starting workflows. Calls doStart() right before the first node is activated.
public start ( integer $parentId = null ) : mixed
$parentId integer
return mixed Execution ID if the workflow has been suspended, null otherwise.
    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;
        }
    }