W3cubDocs

/Symfony 4.1

Workflow

class Workflow implements WorkflowInterface

Methods

__construct(Definition $definition, MarkingStoreInterface $markingStore = null, EventDispatcherInterface $dispatcher = null, string $name = 'unnamed')
Marking getMarking(object $subject)

Returns the object's Marking.

bool can(object $subject, string $transitionName)

Returns true if the transition is enabled.

TransitionBlockerList buildTransitionBlockerList($subject, string $transitionName)

Builds a TransitionBlockerList to know why a transition is blocked.

Marking apply(object $subject, string $transitionName)

Fire a transition.

Transition[] getEnabledTransitions(object $subject)

Returns all enabled transitions.

string getName()
Definition getDefinition()
MarkingStoreInterface getMarkingStore()
MetadataStoreInterface getMetadataStore()

Details

__construct(Definition $definition, MarkingStoreInterface $markingStore = null, EventDispatcherInterface $dispatcher = null, string $name = 'unnamed')

Parameters

Definition $definition
MarkingStoreInterface $markingStore
EventDispatcherInterface $dispatcher
string $name

Marking getMarking(object $subject)

Returns the object's Marking.

Parameters

object $subject A subject

Return Value

Marking The Marking

Exceptions

LogicException

bool can(object $subject, string $transitionName)

Returns true if the transition is enabled.

Parameters

object $subject A subject
string $transitionName A transition

Return Value

bool true if the transition is enabled

TransitionBlockerList buildTransitionBlockerList($subject, string $transitionName)

Builds a TransitionBlockerList to know why a transition is blocked.

Parameters

$subject
string $transitionName

Return Value

TransitionBlockerList

Marking apply(object $subject, string $transitionName)

Fire a transition.

Parameters

object $subject A subject
string $transitionName A transition

Return Value

Marking The new Marking

Exceptions

LogicException If the transition is not applicable

Transition[] getEnabledTransitions(object $subject)

Returns all enabled transitions.

Parameters

object $subject A subject

Return Value

Transition[] All enabled transitions

string getName()

Return Value

string

Definition getDefinition()

Return Value

Definition

MarkingStoreInterface getMarkingStore()

Return Value

MarkingStoreInterface

MetadataStoreInterface getMetadataStore()

Return Value

MetadataStoreInterface

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Workflow/Workflow.html