Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commite7ff39e

Browse files
committed
minor#17878 [Workflow] Do not talk about registry (lyrixx)
This PR was merged into the 6.2 branch.Discussion----------[Workflow] Do not talk about registryThis is not recommended sincesymfony/symfony#46000Commits-------e169f78 [Workflow] Do not talk about registry
2 parents8b278fa +e169f78 commite7ff39e

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

‎components/workflow.rst‎

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -58,33 +58,12 @@ The ``Workflow`` can now help you to decide what *transitions* (actions) are all
5858
on a blog post depending on what *place* (state) it is in. This will keep your domain
5959
logic in one place and not spread all over your application.
6060

61-
When you define multiple workflows you should consider using a ``Registry``,
62-
which is an object that stores and provides access to different workflows.
63-
A registry will also help you to decide if a workflow supports the object you
64-
are trying to use it with::
65-
66-
use Acme\Entity\BlogPost;
67-
use Acme\Entity\Newsletter;
68-
use Symfony\Component\Workflow\Registry;
69-
use Symfony\Component\Workflow\SupportStrategy\InstanceOfSupportStrategy;
70-
71-
$blogPostWorkflow = ...;
72-
$newsletterWorkflow = ...;
73-
74-
$registry = new Registry();
75-
$registry->addWorkflow($blogPostWorkflow, new InstanceOfSupportStrategy(BlogPost::class));
76-
$registry->addWorkflow($newsletterWorkflow, new InstanceOfSupportStrategy(Newsletter::class));
77-
7861
Usage
7962
-----
8063

81-
When you have configured a ``Registry`` with your workflows,
82-
you can retrieve a workflow from it and use it as follows::
83-
8464
// ...
8565
// Consider that $blogPost is in place "draft" by default
8666
$blogPost = new BlogPost();
87-
$workflow = $registry->get($blogPost);
8867

8968
$workflow->can($blogPost, 'publish'); // False
9069
$workflow->can($blogPost, 'to_review'); // True
@@ -103,7 +82,6 @@ method to initialize the object property::
10382

10483
// ...
10584
$blogPost = new BlogPost();
106-
$workflow = $registry->get($blogPost);
10785

10886
// initiate workflow
10987
$workflow->getMarking($blogPost);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp