Programming Language PHP

Namespace Oro\Bundle\WorkflowBundle\Entity

Class WorkflowItem

Method/Function addTransitionRecord

Total Examples 2

2 code examples of PHP Oro\Bundle\WorkflowBundle\Entity\WorkflowItem::addTransitionRecord extracted from open source projects

Was this example useful?
0
                                                    /**
     * Transits a workflow item without checking for preconditions and conditions.
     *
     * @param string|Transition $transition
     *
     * @throws InvalidTransitionException
     * @throws WorkflowException
     */
    public function transitUnconditionally(WorkflowItem $workflowItem, $transition)
    {
        $transition = $this->transitionManager->extractTransition($transition);

        $this->checkTransitionValid($transition, $workflowItem, true);

        $transitionRecord = $this->createTransitionRecord($workflowItem, $transition);
        $transition->transitUnconditionally($workflowItem);
        $workflowItem->addTransitionRecord($transitionRecord);

        $this->aclManager->updateAclIdentities($workflowItem);
        $this->restrictionManager->updateEntityRestrictions($workflowItem);
    }
                                            
Was this example useful?
0
                                                    /**
     * Transit workflow item.
     *
     * @param string|Transition $transition
     *
     * @throws ForbiddenTransitionException
     * @throws InvalidTransitionException
     * @throws WorkflowException
     */
    public function transit(WorkflowItem $workflowItem, $transition, Collection $errors = null)
    {
        $transition = $this->transitionManager->extractTransition($transition);

        $this->checkTransitionValid($transition, $workflowItem, true);

        $transitionRecord = $this->createTransitionRecord($workflowItem, $transition);
        $transition->transit($workflowItem, $errors);
        $workflowItem->addTransitionRecord($transitionRecord);

        $this->aclManager->updateAclIdentities($workflowItem);
        $this->restrictionManager->updateEntityRestrictions($workflowItem);
    }