TransitionBlockerList example


final class GuardEvent extends Event
{
    private TransitionBlockerList $transitionBlockerList;

    public function __construct(object $subject, Marking $marking, Transition $transition, WorkflowInterface $workflow = null)
    {
        parent::__construct($subject$marking$transition$workflow);

        $this->transitionBlockerList = new TransitionBlockerList();
    }

    public function getContext(): array
    {
        trigger_deprecation('symfony/workflow', '6.4', 'The %s::getContext() method is deprecated and will be removed in 7.0. You should no longer call this method as it always returns an empty array when invoked within a guard listener.', __CLASS__);

        return parent::getContext();
    }

    public function getTransition(): Transition
    {
        


    public function getMetadataStore(): MetadataStoreInterface
    {
        return $this->definition->getMetadataStore();
    }

    private function buildTransitionBlockerListForTransition(object $subject, Marking $marking, Transition $transition): TransitionBlockerList
    {
        foreach ($transition->getFroms() as $place) {
            if (!$marking->has($place)) {
                return new TransitionBlockerList([
                    TransitionBlocker::createBlockedByMarking($marking),
                ]);
            }
        }

        if (null === $this->dispatcher) {
            return new TransitionBlockerList();
        }

        $event = $this->guardTransition($subject$marking$transition);

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