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

Commit f03df93

Browse filesBrowse files
Added note regarding workflow "entered" event being dispatched on creation
1 parent 88e1315 commit f03df93
Copy full SHA for f03df93

File tree

Expand file treeCollapse file tree

1 file changed

+11
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-6
lines changed

‎workflow.rst

Copy file name to clipboardExpand all lines: workflow.rst
+11-6Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,29 +215,29 @@ what actions are allowed on a blog post::
215215

216216
// See all the available transitions for the post in the current state
217217
$transitions = $workflow->getEnabledTransitions($post);
218-
218+
219219
Accessing the Workflow in a Class
220220
---------------------------------
221221

222222
To access workflow inside a class, use dependency injection and inject the
223223
registry in the constructor::
224224

225225
use Symfony\Component\Workflow\Registry;
226-
226+
227227
class MyClass
228228
{
229-
229+
230230
private $workflowRegistry;
231-
231+
232232
public function __construct(Registry $workflowRegistry)
233233
{
234234
$this->workflowRegistry = $workflowRegistry;
235235
}
236-
236+
237237
public function toReview(BlogPost $blogPost)
238238
{
239239
$workflow = $this->workflowRegistry->get($blogPost);
240-
240+
241241
// Update the currentState on the post
242242
try {
243243
$workflow->apply($post, 'to_review');
@@ -339,6 +339,11 @@ order:
339339
The leaving and entering events are triggered even for transitions that stay
340340
in same place.
341341

342+
.. versionadded:: 4.3
343+
344+
Following events are also dispatched when the subject enters the workflow
345+
for the first time: ``workflow.entered`` and ``workflow.[worflow name].entered``.
346+
342347
Here is an example of how to enable logging for every time a "blog_publishing"
343348
workflow leaves a place::
344349

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.