Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple transitions with the same name #9

Open
kgilden opened this issue Jan 15, 2015 · 2 comments
Open

Support for multiple transitions with the same name #9

kgilden opened this issue Jan 15, 2015 · 2 comments

Comments

@kgilden
Copy link

kgilden commented Jan 15, 2015

Currently all transitions must be uniquely named. There's support to allow a transition to go from multiple states to a single end state, i.e.:

$config = ['transitions' => [
    'foo' => [
        'from' => ['a', 'b', 'c'],
        'to' => 'd',
    ],
]];

I propose adding support to have transitions going to different states, but having a same name, i.e.:

$config = ['transitions' => [
    'foo' => [
        [
            'from' => ['a', 'b', 'c'],
            'to' => 'd',
        ],
        [
            'from' => ['e', 'f'],
            'to' => 'g'
        ]
    ],
]];

This might not seem benefitial at first, but would be a huge help, when using the event dispatcher. It would enable having nifty listeners such as listening to confirm transitions and sending e-mails regarding the state change. No explicit listing of transitions would be necessary.

BC can also be kept by simply keeping support for the old structure.

Would you be interested in having this merged, should I implement it?

@RobvH
Copy link

RobvH commented Jan 16, 2017

Without having read this first, I wrote the Pr because I can't port the state machine for the Kinesis driver without it. The syntax used is identical, I think.

@Gennnji
Copy link

Gennnji commented Sep 16, 2017

I think it's a good idea!
Especially, it would be great to add different guards for some variants of using same transition, so the machine could change to the state accordingly guard with true result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants