Skip to content

Commit b684577

Browse files
committed
Merge branch '6.4' into 7.1
* 6.4: [Workflow] Do to talk about workflow, and explain what support option is for
2 parents 2118944 + 547066b commit b684577

File tree

2 files changed

+3
-35
lines changed

2 files changed

+3
-35
lines changed

components/workflow.rst

-35
Original file line numberDiff line numberDiff line change
@@ -85,41 +85,6 @@ method to initialize the object property::
8585
// initiate workflow
8686
$workflow->getMarking($blogPost);
8787

88-
Using The Workflow Registry
89-
---------------------------
90-
91-
When you define multiple workflows you may consider using a ``Registry``,
92-
which is an object that stores and provides access to different workflows.
93-
A registry will also help you to decide if a workflow supports the object you
94-
are trying to use it with::
95-
96-
use Acme\Entity\BlogPost;
97-
use Acme\Entity\Newsletter;
98-
use Symfony\Component\Workflow\Registry;
99-
use Symfony\Component\Workflow\SupportStrategy\InstanceOfSupportStrategy;
100-
101-
$blogPostWorkflow = ...;
102-
$newsletterWorkflow = ...;
103-
104-
$registry = new Registry();
105-
$registry->addWorkflow($blogPostWorkflow, new InstanceOfSupportStrategy(BlogPost::class));
106-
$registry->addWorkflow($newsletterWorkflow, new InstanceOfSupportStrategy(Newsletter::class));
107-
108-
You can then use the registry to get the workflow for a specific object::
109-
110-
$blogPost = new BlogPost();
111-
$workflow = $registry->get($blogPost);
112-
113-
// initiate workflow
114-
$workflow->getMarking($blogPost);
115-
116-
.. caution::
117-
118-
Beware that injecting the ``Registry`` into your services is **not**
119-
recommended. Indeed, it prevents some optimization like lazy-loading
120-
from working and could be a performance hog. Instead, you should always
121-
inject the workflow you need.
122-
12388
Learn more
12489
----------
12590

workflow/workflow-and-state-machine.rst

+3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Below is the configuration for the pull request state machine.
8181
marking_store:
8282
type: 'method'
8383
property: 'currentPlace'
84+
# The "supports" option is useful only if you are using Twig functions ('workflow_*')
8485
supports:
8586
- App\Entity\PullRequest
8687
initial_marking: start
@@ -131,6 +132,7 @@ Below is the configuration for the pull request state machine.
131132
132133
<framework:marking-store type="method" property="currentPlace"/>
133134
135+
<!-- The "supports" option is useful only if you are using Twig functions ('workflow_*') -->
134136
<framework:support>App\Entity\PullRequest</framework:support>
135137
136138
<framework:place>start</framework:place>
@@ -199,6 +201,7 @@ Below is the configuration for the pull request state machine.
199201
200202
$pullRequest
201203
->type('state_machine')
204+
// The "supports" option is useful only if you are using Twig functions ('workflow_*')
202205
->supports(['App\Entity\PullRequest'])
203206
->initialMarking(['start']);
204207

0 commit comments

Comments
 (0)