@@ -58,33 +58,12 @@ The ``Workflow`` can now help you to decide what *transitions* (actions) are all
5858on a blog post depending on what *place * (state) it is in. This will keep your domain
5959logic 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-
7861Usage
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