concrete/src/Workflow/Request/Request.php
protected function triggerRequest(\PermissionKey $pk)
    {
        if (!$this->wrID) {
            $this->save();
        }

        if (!$pk->canPermissionKeyTriggerWorkflow()) {
            throw new \Exception(t('This permission key cannot start a workflow.'));
        }

        $pa = $pk->getPermissionAccessObject();
        $skipWorkflow = true;
        if (is_object($pa)) {
            $workflows = $pa->getWorkflows();
            foreach ($workflows as $wf) {
                if ($wf->validateTrigger($this)) {
                    $wp = $this->addWorkflowProgress($wf);
                    $response = $wp->getWorkflowProgressResponseObject();
                    if ($response instanceof SkippedResponse) {
                        // Since the response was skipped, we delete the workflow progress operation and keep moving.
                        $wp->delete();
                    } else {
                        $skipWorkflow = false;
                    }
                    $event = new GenericEvent();
                    $event->setArgument('progress', $wp);
                    Events::dispatch('workflow_triggered', $event);
                }
            }
        }

        if ($skipWorkflow) {
            $defaultWorkflow = new EmptyWorkflow();
            $wp = $this->addWorkflowProgress($defaultWorkflow);

            $event = new GenericEvent();
            $event->setArgument('progress', $wp);
            Events::dispatch('workflow_triggered', $event);

            return $wp->getWorkflowProgressResponseObject();
        }
    }
protected function triggerRequest(\PermissionKey $pk)
    {
        if (!$this->wrID) {
            $this->save();
        }

        if (!$pk->canPermissionKeyTriggerWorkflow()) {
            throw new \Exception(t('This permission key cannot start a workflow.'));
        }

        $pa = $pk->getPermissionAccessObject();
        $skipWorkflow = true;
        if (is_object($pa)) {
            $workflows = $pa->getWorkflows();
            foreach ($workflows as $wf) {
                if ($wf->validateTrigger($this)) {
                    $wp = $this->addWorkflowProgress($wf);
                    $response = $wp->getWorkflowProgressResponseObject();
                    if ($response instanceof SkippedResponse) {
                        // Since the response was skipped, we delete the workflow progress operation and keep moving.
                        $wp->delete();
                    } else {
                        $skipWorkflow = false;
                    }
                    $event = new GenericEvent();
                    $event->setArgument('progress', $wp);
                    Events::dispatch('workflow_triggered', $event);
                }
            }
        }

        if ($skipWorkflow) {
            $defaultWorkflow = new EmptyWorkflow();
            $wp = $this->addWorkflowProgress($defaultWorkflow);

            $event = new GenericEvent();
            $event->setArgument('progress', $wp);
            Events::dispatch('workflow_triggered', $event);

            return $wp->getWorkflowProgressResponseObject();
        }
    }
protected function triggerRequest ( \ PermissionKey $ pk ) { if ( ! $ this -> wrID ) { $ this -> save ( ) ; } if ( ! $ pk -> canPermissionKeyTriggerWorkflow ( ) ) { throw new \ Exception ( t ( 'This permission key cannot start a workflow.' ) ) ; } $ pa = $ pk -> getPermissionAccessObject ( ) ; $ skipWorkflow = true ; if ( is_object ( $ pa ) ) { $ workflows = $ pa -> getWorkflows ( ) ; foreach ( $ workflows as $ wf ) { if ( $ wf -> validateTrigger ( $ this ) ) { $ wp = $ this -> addWorkflowProgress ( $ wf ) ; $ response = $ wp -> getWorkflowProgressResponseObject ( ) ; if ( $ response instanceof SkippedResponse ) { // Since the response was skipped, we delete the workflow progress operation and keep moving. $ wp -> delete ( ) ; } else { $ skipWorkflow = false ; } $ event = new GenericEvent ( ) ; $ event -> setArgument ( 'progress' , $ wp ) ; Events :: dispatch ( 'workflow_triggered' , $ event ) ; } } } if ( $ skipWorkflow ) { $ defaultWorkflow = new EmptyWorkflow ( ) ; $ wp = $ this -> addWorkflowProgress ( $ defaultWorkflow ) ; $ event = new GenericEvent ( ) ; $ event -> setArgument ( 'progress' , $ wp ) ; Events :: dispatch ( 'workflow_triggered' , $ event ) ; return $ wp -> getWorkflowProgressResponseObject ( ) ; } }
Triggers a workflow request, queries a permission key to see what workflows are attached to it
and initiates them.

@param \PermissionKey $pk

@return optional WorkflowProgress
Triggers a workflow request queries a permission key to see what workflows are attached to it and initiates them .