Skip to content

Commit e169f78

Browse files
authored
[Workflow] Do not talk about registry
This is not recommended since symfony/symfony#46000
1 parent 87b014d commit e169f78

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)