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

Added explaination on context in events and initial marking #13947

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

Conversation

epitre
Copy link
Contributor

@epitre epitre commented Jul 9, 2020

No description provided.

@epitre epitre force-pushed the eventWithContext branch from 58e28f2 to 82a94f7 Compare July 9, 2020 10:50
@pluk77
Copy link

pluk77 commented Jul 9, 2020

@epitre Nice solution, which will indeed also solve the issue of the non-dispatched initial entered event.

@pluk77
Copy link

pluk77 commented Jul 9, 2020

@epitre Perhaps you can also add a note about the initial marking option to make it clear it is optional and will default to the first place if not defined.

@epitre
Copy link
Contributor Author

epitre commented Jul 9, 2020

@epitre Perhaps you can also add a note about the initial marking option to make it clear it is optional and will default to the first place if not defined.

it is explained here : https://github.com/symfony/symfony-docs/pull/13947/files#diff-c94d89e3669d4257383cfe5faf73e644R97

@pluk77
Copy link

pluk77 commented Jul 9, 2020

@epitre Perhaps you can also add a note about the initial marking option to make it clear it is optional and will default to the first place if not defined.

it is explained here : https://github.com/symfony/symfony-docs/pull/13947/files#diff-c94d89e3669d4257383cfe5faf73e644R97

I was more referring to the config option initial_marking in the workflow configuration file (yml, xml, php). It is not clear from the current docs that the initial marking will always be the place that is first in the list of defined places, unless you set a different place using initial_marking.

Even if you do not instantiate the workflow by using getMarking() but go directly to apply() the subject will still be placed in the initial place first if there is no marking on the subject yet.

Hope I am making sense?

@@ -94,6 +94,16 @@ you can retrieve a workflow from it and use it as follows::
$workflow->can($blogPost, 'publish'); // True
$workflow->getEnabledTransitions($blogPost); // $blogPost can perform transition "publish" or "reject"

If you want to initiate your worflow, you can simply call ``getMarking``::
Copy link
Contributor

Choose a reason for hiding this comment

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

workflow with k

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks

lyrixx added a commit to symfony/symfony that referenced this pull request Aug 12, 2020
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Workflow] Added Context to Workflow Event

There's also a default context for the initial marking event.

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #37421
| License       | MIT
| Doc PR        | symfony/symfony-docs#13947

This time, I need context in the events, because, sometimes, the transition is automatic and sometimes, it is manual. I want to be able to make the difference. I figured using the context for that is a good idea. I hope you do too :)

By the way, I believe it also fixes #37421 . I took @pluk77 request to be able to differentiate an initial marking by having a default context in that case

Commits
-------

bfe07dd Added Context to Workflow Event There's also a default context for the initial marking event.
symfony-splitter pushed a commit to symfony/twig-bridge that referenced this pull request Aug 12, 2020
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Workflow] Added Context to Workflow Event

There's also a default context for the initial marking event.

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #37421
| License       | MIT
| Doc PR        | symfony/symfony-docs#13947

This time, I need context in the events, because, sometimes, the transition is automatic and sometimes, it is manual. I want to be able to make the difference. I figured using the context for that is a good idea. I hope you do too :)

By the way, I believe it also fixes #37421 . I took @pluk77 request to be able to differentiate an initial marking by having a default context in that case

Commits
-------

bfe07dda83 Added Context to Workflow Event There's also a default context for the initial marking event.
@lyrixx
Copy link
Member

lyrixx commented Aug 12, 2020

FYI, The pull request has been merged

@nicolas-grekas nicolas-grekas deleted the branch symfony:master December 7, 2020 16:34
@nicolas-grekas
Copy link
Member

This PR has been closed because the master has been removed.
Please submit it again against the appropriate branch.

@epitre
Copy link
Contributor Author

epitre commented Dec 8, 2020

@nicolas-grekas I thought it was merge as said by @lyrixx ?

Anyway, I made a new PR : #14678

@nicolas-grekas
Copy link
Member

I think @lyrixx meant that the feature has been merged on the code side (but not on the doc side.)

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.