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] Added Function (and Twig extension) to retrieve a specific transition #37428

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

Conversation

epitre
Copy link
Contributor

@epitre epitre commented Jun 26, 2020

You can now easily retrieve a specific transition. Useful when you want the metadata of a specific transition.

Q A
Branch? master
Bug fix? no
New feature? yes
Deprecations? no
Tickets hmmmm, should I create a ticket first ?
License MIT
Doc PR symfony/symfony-docs#13907

I needed to get the metadata of a transition, but in order to do that, you need the transition object. So here is a PR to easily get the transition object

@epitre

This comment has been minimized.

@noniagriconomie

This comment has been minimized.

src/Symfony/Component/Workflow/Workflow.php Show resolved Hide resolved
src/Symfony/Component/Workflow/Workflow.php Outdated Show resolved Hide resolved
src/Symfony/Component/Workflow/Workflow.php Outdated Show resolved Hide resolved
@epitre epitre force-pushed the workflowTransition branch from f9074aa to 9a315b9 Compare June 26, 2020 15:14
@nicolas-grekas nicolas-grekas added this to the next milestone Jun 28, 2020
src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php Outdated Show resolved Hide resolved
@epitre epitre force-pushed the workflowTransition branch from 9a315b9 to 1f86a53 Compare June 29, 2020 07:34
@epitre epitre requested a review from nicolas-grekas June 29, 2020 07:46
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.

Thanks for your contribution.

Instead of the current implementation, I would simplify a lot the code:
You could leverage the current getEnabledTransitions() method in the bridge, without implementing a new method.

Less code == less bug :)

src/Symfony/Component/Workflow/Tests/WorkflowTest.php Outdated Show resolved Hide resolved
src/Symfony/Component/Workflow/Workflow.php Outdated Show resolved Hide resolved
@epitre
Copy link
Contributor Author

epitre commented Jun 30, 2020

Thanks for your contribution.

Instead of the current implementation, I would simplify a lot the code:
You could leverage the current getEnabledTransitions() method in the bridge, without implementing a new method.

Less code == less bug :)

@lyrixx That's actually what I did first (and that's what I currently do in my project). And then I thought it would make more sense to have a dedicated function...
What I need in a twig template, someone might need it in a service (or somewhere else ^^)

@epitre epitre force-pushed the workflowTransition branch 4 times, most recently from 550d5de to 4001b15 Compare June 30, 2020 23:01
@epitre
Copy link
Contributor Author

epitre commented Jun 30, 2020

Now, I have a problem with graphviz and PlantUML...

Maybe I should not have changed the complex workflow ^^

src/Symfony/Component/Workflow/Workflow.php Outdated Show resolved Hide resolved
@epitre epitre force-pushed the workflowTransition branch from 4001b15 to eb1de08 Compare July 1, 2020 07:38
You can now easily retrieve a specific transition. Useful when you want the metadata of a specific transition.
@epitre epitre force-pushed the workflowTransition branch from eb1de08 to 9be8614 Compare July 1, 2020 07:39
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.

Thanks for your first contributions 👍

I forgot to ask: Could you update both CHANGELOG and this will be perfect 💛

@epitre
Copy link
Contributor Author

epitre commented Jul 1, 2020

@lyrixx i updated the workflow changelog.
What is the other changelog you want me to update ?

@lyrixx
Copy link
Member

lyrixx commented Jul 1, 2020

@epitre
Copy link
Contributor Author

epitre commented Jul 1, 2020

@lyrixx Done !

@epitre epitre force-pushed the workflowTransition branch from c54b457 to 210048c Compare July 1, 2020 08:40
@fabpot
Copy link
Member

fabpot commented Jul 1, 2020

Thank you @epitre.

fabpot added a commit that referenced this pull request Jul 1, 2020
…ieve a specific transition (Carlos Pereira De Amorim)

This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[Workflow] Added Function (and Twig extension) to retrieve a specific transition

You can now easily retrieve a specific transition. Useful when you want the metadata of a specific transition.

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | hmmmm, should I create a ticket first ?
| License       | MIT
| Doc PR        | symfony/symfony-docs#13907

I needed to get the metadata of a transition, but in order to do that, you need the transition object. So here is a PR to easily get the transition object

Commits
-------

0eebe74 [Workflow] Added Function (and Twig extension) to retrieve a specific transition
@fabpot fabpot closed this Jul 1, 2020
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.2 Oct 5, 2020
@fabpot fabpot mentioned this pull request Oct 5, 2020
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.

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