8000 Added missing events description by Guite · Pull Request #7528 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Added missing events description #7528

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
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Proposed some rewords
  • Loading branch information
javiereguiluz authored Feb 27, 2017
commit 89f30cda11e1afb062265914044f4deedf07b059
16 changes: 9 additions & 7 deletions workflow/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -229,23 +229,25 @@ Available events

The following events are dispatched for all workflows:

* ``workflow.guard``: occurs before a transition is started. Allows you to prevent it by calling ``$event->setBlocked(true);`` like shown above.
* ``workflow.leave``: occurs when an object leaves it's current state.
* ``workflow.transition``: occurs when the transition to the new state is launched.
* ``workflow.enter``: occurs when the new state is just defined on the object.
* ``workflow.guard``: occurs just before starting a transition. It allows you to
prevent the transition by calling ``$event->setBlocked(true);`` as shown above.
Copy link
Contributor
@HeahDude HeahDude Feb 27, 2017

Choose a reason for hiding this comment

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

It is also fired when testing available transitions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@HeahDude added

* ``workflow.leave``: occurs just after an object has left it's current state.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should mention that all events give carries the subject and the transition.
Also I think we should clarify what state is available in the event:

* ``workflow.leave``: carries the marking with the initial places, occurs just before the transition.
* ``workflow.transition``: carries the marking with the current places, occurs during the transition.
* ``workflow.enter``: carries the marking with the new places, occurs just after the transition.

Actually while checking this I've opened symfony/symfony#21793.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@HeahDude added

* ``workflow.transition``: occurs just before starting to transition to the new state.
* ``workflow.enter``: occurs just after the object has entered into the new state.

2. Workflow-specific events

All the events are also triggered for each workflow specifically. This allows you to react only for the events of a specific workflow.
All the previous events are also triggered for each workflow individually, so
you can react only to the events of a specific workflow:

* ``workflow.<workflow_name>.guard``
* ``workflow.<workflow_name>.leave``
* ``workflow.<workflow_name>.transition``
* ``workflow.<workflow_name>.enter``

3. Transition- or state-specific events
3. Transition or state-specific events

You can even listen to only specific transitions or states for a specific workflow:
You can even listen to some specific transitions or states for a specific workflow:

* ``workflow.<workflow_name>.guard.<transition_name>``
* ``workflow.<workflow_name>.leave.<state_name>``
Expand Down
0