getTransitionName example

$stateMachine = $this->getStateMachine($stateField->getStateMachineName()$context);
            $repository = $this->definitionRegistry->getRepository($transition->getEntityName());

            $fromPlace = $this->getFromPlace(
                $transition->getEntityName(),
                $transition->getEntityId(),
                $transition->getStateFieldName(),
                $context,
                $repository
            );

            if (empty($transition->getTransitionName())) {
                $transitions = $this->getAvailableTransitionsById($stateMachine->getTechnicalName()$fromPlace->getId()$context);
                $transitionNames = array_map(fn (StateMachineTransitionEntity $transition) => $transition->getActionName()$transitions);

                throw StateMachineException::illegalStateTransition($fromPlace->getId(), '', $transitionNames);
            }

            try {
                $toPlace = $this->getTransitionDestinationById(
                    $stateMachine->getTechnicalName(),
                    $fromPlace->getId(),
                    $transition->getTransitionName(),
                    
try {
            $workflow->apply($subject, 't2', $context);

            $this->fail('Should throw an exception');
        } catch (NotEnabledTransitionException $e) {
            $this->assertSame('Transition "t2" is not enabled for workflow "unnamed".', $e->getMessage());
            $this->assertCount(1, $e->getTransitionBlockerList());
            $list = iterator_to_array($e->getTransitionBlockerList());
            $this->assertSame('The marking does not enable the transition.', $list[0]->getMessage());
            $this->assertSame($e->getWorkflow()$workflow);
            $this->assertSame($e->getSubject()$subject);
            $this->assertSame($e->getTransitionName(), 't2');
            $this->assertSame($e->getContext()$context);
        }
    }

    public function testApply()
    {
        $definition = $this->createComplexWorkflowDefinition();
        $subject = new Subject();
        $workflow = new Workflow($definitionnew MethodMarkingStore());

        $marking = $workflow->apply($subject, 't1');

        
Home | Imprint | This part of the site doesn't use cookies.