Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Workflow] Allow transition when many places in transition froms #22017

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

Closed
wants to merge 2 commits into from
Closed

[Workflow] Allow transition when many places in transition froms #22017

wants to merge 2 commits into from

Conversation

sebdec
Copy link
Contributor

@sebdec sebdec commented Mar 16, 2017

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

It is about the workflow component
Actually a permission with multiple places in froms can not be applied
This PR solve that

$this->assertCount(1, $transitions);
$this->assertSame('t5', $transitions[0]->getName());
$this->assertCount(2, $transitions);
$this->assertSame('t2', $transitions[0]->getName());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sebdec this change is not valid. To apply t2, the subject must be in all froms, in this case "b" and "c", but only "c" is marked.

Copy link
Contributor Author

@sebdec sebdec Mar 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking it was a bug
Is there a solution to apply t2 if the subject is at least in one from ("b" or "c")?

@lyrixx
Copy link
Member

lyrixx commented Mar 16, 2017

Hello.

Thanks for trying to solve a bug but there are no bug here.

This is indeed the right behaviour. You are currently using the workflow net implementation and it works like that. It means that a transition becomes enabled if and only if:

  1. A token is present in all previous places (ie: your subject is in all place)
  2. All guard listener do not block the transition

It looks like you want to use a state_machine. If you are using the workflow in the full stack framework, you can enable the state machine like that: https://github.com/lyrixx/SFLive-Paris2016-Workflow/blob/master/app/config/workflow.yml#L37

@lyrixx lyrixx closed this Mar 16, 2017
lyrixx added a commit that referenced this pull request Mar 16, 2017
This PR was merged into the 3.2 branch.

Discussion
----------

[Workflow] Added more tests

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #22017
| License       | MIT
| Doc PR        | -

---

It's not the first time that people try to fix the workflow because they don't understand how it works. Basically, it's because the default configuration is using the "workflow" and not the "state_machine" type. It was a mistake but it's too late because it will be BC break. May be we could solve that by triggering a deprecation if the type is not explicit. But nobody will see it because it will be triggered during the compilation. It could also be fixed with more documentation.

Anyway, I want to add more tests to cover that with a little comment in the test suite. Right now, only one tests failed. With this PR more tests are failing.

Commits
-------

e47cfe9 [Workflow] Added more tests
@sebdec
Copy link
Contributor Author

sebdec commented Mar 16, 2017

ok thank you lyrixx for your answer and the tests added

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.

4 participants