Skip to content

Workflow "can" function checks only first valid transition #20788

@ggabrovski

Description

@ggabrovski

Function can($subject, $transitionName) in Workflow.php need to returns true if the transition is enabled,
but getTransitionForSubject return only the first transition in transitions that is valid for the object.
And in the example below the only valid transition is "feedback". The other two "review" and "close" are missing. If the initial place is "opened".
test1

Example:

framework:
    workflows:
        pull_request:
            marking_store:
                type: single_state
                arguments:
                    - marking
            supports:
                - AppBundle\Entity\PullRequest
            places:
                - opened
                - closed
                - needs_review
                - reviewed
                - merged
            initial_place: opened
            transitions:
                feedback:
                    from: opened
                    to:   needs_review
                review:
                    from: [opened, needs_review]
                    to:   reviewed
                merge:
                    from: reviewed
                    to:   merged
                close:
                    from: [opened, needs_review, reviewed]
                    to:   closed

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions