Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Workflow] Make sure we do not run the next transition on an updated state #28322

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

Merged
merged 1 commit into from
Sep 4, 2018

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Aug 31, 2018

Q A
Branch? 4.1
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR

When you have a workflow like this, where all transitions are named the same.

php

The current behavior on $stateMachine->apply($object, 'next') is that it will go to "done".

It will do this because it checks the current "froms" at each iteration in the loop in apply(). It should check the valid transition before it actually apply them.

@fabpot
Copy link
Member

fabpot commented Sep 4, 2018

Thank you @Nyholm.

@fabpot fabpot merged commit d9dda76 into symfony:4.1 Sep 4, 2018
fabpot added a commit that referenced this pull request Sep 4, 2018
…an updated state (Nyholm)

This PR was squashed before being merged into the 4.1 branch (closes #28322).

Discussion
----------

[Workflow] Make sure we do not run the next transition on an updated state

| Q             | A
| ------------- | ---
| Branch?       | 4.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        |

When you have a workflow like this, where all transitions are named the same.

![php](https://user-images.githubusercontent.com/1275206/44908106-87914680-ad1a-11e8-9c6f-e58de4b255e8.png)

The current behavior on `$stateMachine->apply($object, 'next')` is that it will go to "done".

It will do this because it checks the current "froms" at each iteration in the loop in `apply()`. It should check the valid transition before it actually apply them.

Commits
-------

d9dda76 [Workflow] Make sure we do not run the next transition on an updated state
@Nyholm Nyholm deleted the workflow-rebuild branch September 4, 2018 08:36
@Nyholm
Copy link
Member Author

Nyholm commented Sep 4, 2018

Thank you for merging

@Padam87
Copy link
Contributor

Padam87 commented Sep 24, 2018

@Nyholm thank you. I was having a problem with one of my listeners triggering twice, because of this transition:

                'send' => [
                    'from' => [Quotation::STATUS_NEW, Quotation::STATUS_SENT],
                    'to' => Quotation::STATUS_SENT,
                ],

This was the cause.

@fabpot fabpot mentioned this pull request Sep 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.