8000 [Workflow] Method buildTransitionBlockerList returns TransitionBlockerList of incorrect transition · Issue #28432 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Workflow] Method buildTransitionBlockerList returns TransitionBlockerList of incorrect transition #28432
Closed
@Tetragramat

Description

@Tetragramat

Symfony version(s) affected: 4.1.4

Description
When using multiple places for transition in from, generated transitions are broken.

Following configuration

framework:
    workflows:
       verification:
            type: state_machine
            marking_store:
                type: single_state
                arguments:
                    - 'state'
            supports:
                - App\Entity\Verification
            audit_trail: true
            initial_place: created
            places:
                - draft
                - created
                - pending
                - verified
                - cancelled
                - refused
            transitions:
                pending:
                    from: [created]
                    to: pending
                verified:
                    from: [pending]
                    to: verified
                cancelled:
                    from: [created, pending, verified]
                    to: cancelled
                refused:
                    from: [pending]
                    to: refused

generates these correct places

array:6 [
  "draft" => "draft"
  "created" => "created"
  "pending" => "pending"
  "verified" => "verified"
  "cancelled" => "cancelled"
  "refused" => "refused"
]

and multiple incorrect cancelled transitions

array:6 [
  0 => Symfony\Component\Workflow\Transition {#17032
    -name: "pending"
    -froms: array:1 [
      0 => "created"
    ]
    -tos: array:1 [
      0 => "pending"
    ]
  }
  1 => Symfony\Component\Workflow\Transition {#17033
    -name: "verified"
    -froms: array:1 [
      0 => "pending"
    ]
    -tos: array:1 [
      0 => "verified"
    ]
  }
  2 => Symfony\Component\Workflow\Transition {#17034
    -name: "cancelled"
    -froms: array:1 [
      0 => "created"
    ]
    -tos: array:1 [
      0 => "cancelled"
    ]
  }
  3 => Symfony\Component\Workflow\Transition {#17035
    -name: "cancelled"
    -froms: array:1 [
      0 => "pending"
    ]
    -tos: array:1 [
      0 => "cancelled"
    ]
  }
  4 => Symfony\Component\Workflow\Transition {#17036
    -name: "cancelled"
    -froms: array:1 [
      0 => "verified"
    ]
    -tos: array:1 [
      0 => "cancelled"
    ]
  }
  5 => Symfony\Component\Workflow\Transition {#17037
    -name: "refused"
    -froms: array:1 [
      0 => "pending"
    ]
    -tos: array:1 [
      0 => "refused"
    ]
  }
]

Expected result is single cancelled transition with froms containing places created, pending and verified.
So I would be able to make cancelled transition from created place without generated TransitionBlocker::createBlockedByMarking.

Code is basically same as in following docs https://symfony.com/doc/4.1/workflow/state-machines.html
So I suppose it is bug not feature.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0