Skip to content

PR#22 broke the correct definition of workflow's multiple from. #39

Description

@cirdog

I'm not sure what bug this should have fixed but it broke something else.

Instead of having 1 transition with multiple froms you get 2 transition with 1 from. This way you can't force a transition to have multiple froms.

This changed should be reverted or it a better fix should be created.

To be as precise as possible when using the example config:

<?php

return [
    'straight'   => [
        'type'          => 'state_machine',
        'marking_store' => [
            'type'      => 'single_state',
            'arguments' => ['currentPlace']
        ],
        'supports'      => ['App\Payment'],
        'places'        => ['initial', 'payment', 'waiting'],
        'transitions'   => [
            'transitions'   => [
                'payment_state'      => [
                    'from' => 'initial',
                    'to'   => 'payment',
                ],
                'waiting_state'      => [
                    'from' => [
                        'initial',
                        'payment',
                    ],
                    'to'   => 'waiting',
                ],
            ],
        ],
    ]
];

This is wat i expect:

{Symfony\Component\Workflow\Transition} [3]
 name = "waiting_state"
 froms = {array} [2]
  0 = "initial"
  1 = "payment"
 tos = {array} [1]
  0 = "waiting"

And this is what i get:

{Symfony\Component\Workflow\Transition} [3]
 name = "waiting_state"
 froms = {array} [1]
  0 = "initial"
 tos = {array} [1]
  0 = "waiting"
{Symfony\Component\Workflow\Transition} [3]
 name = "waiting_state"
 froms = {array} [1]
  0 = "payment"
 tos = {array} [1]
  0 = "waiting"

For now I am reverting back to 1.2.0 as this works there.

Originally posted by @MyDigitalLife in https://github.com/_render_node/MDEyOklzc3VlQ29tbWVudDQxNzI5MjMyOA==/timeline/issue_comment#issuecomment-417292328

PR#22 breaks the SINGLE transition with multi-froms into 2 individual transitions with single-from , and this act broke the assumption of workflow requiring all froms to be fulfilled before leaving the place.

Now fulfilling any one of the froms will make it transition and it's obviously incorrect. Also I've reverted the code back to its previous state and it worked perfectly & correctly.

Please revert PR#22 to make workflow usable according to the specs again. The main point here is that multi-from doesn't mean "fulfilling any of the them" but "fulfilling ALL of them".

Thanks very much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions