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

Skip to content

[Workflow] Added new validator to make sure each place has unique translation names #21271

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 4 commits into from

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Jan 13, 2017

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

A definition where a place that has transitions with the same name is an invalid definition.

invalid1: 
  places: ['a', 'b', 'c']
  transitions: 
    t1: 
      from: a
      to: b
    t1: 
      from: a
      to: c

valid1: 
  places: ['a', 'b', 'c']
  transitions: 
    t1: 
      from: a
      to: b
    t2: 
      from: a
      to: c

valid2: 
  places: ['a', 'b', 'c']
  transitions: 
    t1: 
      from: a
      to: b
    t1: 
      from: b
      to: c

valid3: 
  places: ['a', 'b', 'c', 'd']
  transitions: 
    t1: 
      from: ['a', 'b']
      to: d
    t2: 
      from: ['a', 'b']
      to: c

FYI @lyrixx

@Nyholm Nyholm changed the title Added new validator to make sure each place has unique translation names [Workflow] Added new validator to make sure each place has unique translation names Jan 13, 2017
Copy link
Member

@lyrixx lyrixx left a comment

Choose a reason for hiding this comment

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

👍

@lyrixx lyrixx added this to the 3.2 milestone Jan 13, 2017
@lyrixx
Copy link
Member

lyrixx commented Jan 13, 2017

Note: It should be merge in 3.2 and not master.

@@ -16,6 +16,7 @@
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\Workflow\Validator\DefinitionValidatorInterface;
use Symfony\Component\Workflow\Validator\StateMachineValidator;
use Symfony\Component\Workflow\Validator\UniqueTransitionNameValidator;
Copy link
Member

Choose a reason for hiding this comment

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

missing composer.json update I guess, for ^3.2.3

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no reference to symfony/workflow at all in the composer.json of the framework bundle. Should I still add one?

@ro0NL
Copy link
Contributor

ro0NL commented Jan 14, 2017

What about moving it to WorkflowValidator? The StateMachineValidator already enforces this right?

@Nyholm
Copy link
Member Author

Nyholm commented Jan 14, 2017

Thank you @ro0NL. You are correct. The StateMachineValidator has this test already but it is missing in the WorkflowValidator.

I will merge this test to the Workflow validator.

@fabpot
Copy link
Member

fabpot commented Jan 15, 2017

Looks like a new feature to me, not a bug fix. I think it should be merged in 3.3 instead.

@Nyholm
Copy link
Member Author

Nyholm commented Jan 16, 2017

Looks like a new feature to me, not a bug fix.

This PR makes sure the Definition is not invalid. That is why I marked it as a "bugfix". But one could argue that all PRs to the Validator as bugfixes... Anyhow.

Since this check exist for the StateMachineValidator, I've updated the PR to include this check in the Workflow validator only.

@nicolas-grekas
Copy link
Member

Generally : any new visible interface => feature.
Now that this just tweaks an edge case behavior only, it may much likely qualify as bug fix :)

@lyrixx
Copy link
Member

lyrixx commented Jan 16, 2017

For me it's a bug fix too, because if the definition is not valid, the workflow will not work correctly.

@fabpot
Copy link
Member

fabpot commented Jan 18, 2017

Thank you @Nyholm.

fabpot added a commit that referenced this pull request Jan 18, 2017
… unique translation names (Nyholm)

This PR was submitted for the master branch but it was merged into the 3.2 branch instead (closes #21271).

Discussion
----------

[Workflow] Added new validator to make sure each place has unique translation names

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

A definition where a place that has transitions with the same name is an invalid definition.

```yaml
invalid1:
  places: ['a', 'b', 'c']
  transitions:
    t1:
      from: a
      to: b
    t1:
      from: a
      to: c

valid1:
  places: ['a', 'b', 'c']
  transitions:
    t1:
      from: a
      to: b
    t2:
      from: a
      to: c

valid2:
  places: ['a', 'b', 'c']
  transitions:
    t1:
      from: a
      to: b
    t1:
      from: b
      to: c

valid3:
  places: ['a', 'b', 'c', 'd']
  transitions:
    t1:
      from: ['a', 'b']
      to: d
    t2:
      from: ['a', 'b']
      to: c
```

FYI @lyrixx

Commits
-------

eece8ad [Workflow] Added new validator to make sure each place has unique translation names
@fabpot fabpot closed this Jan 18, 2017
@Nyholm Nyholm deleted the workflow-unique-name branch January 18, 2017 06:02
@fabpot fabpot mentioned this pull request Feb 6, 2017
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.

7 participants