raoul2000\workflow\base\SimpleWorkflowBehavior::enterWorkflow PHP Method

enterWorkflow() public method

If the owner model is already in a workflow, an exception is thrown. If this method ends with no error, the owner model's status is the initial status of the selected workflow.
public enterWorkflow ( string $workflowId = null ) : boolean
$workflowId string the ID of the workflow the owner model must be inserted to or NULL to insert into the model's default workflow.
return boolean TRUE if the operation succeeded, FALSE otherwise
    public function enterWorkflow($workflowId = null)
    {
        $result = false;
        if ($this->hasWorkflowStatus()) {
            throw new WorkflowException("Model already in a workflow");
        }
        $wId = $workflowId === null ? $this->getDefaultWorkflowId() : $workflowId;
        $workflow = $this->_wfSource->getWorkflow($wId);
        if ($workflow !== null) {
            $result = $this->sendToStatusInternal($workflow->getInitialStatusId(), false);
        } else {
            throw new WorkflowException("No workflow found for id : " . $wId);
        }
        return $result;
    }