@@ -81,6 +81,7 @@ Below is the configuration for the pull request state machine.
81
81
marking_store :
82
82
type : ' method'
83
83
property : ' currentPlace'
84
+ # The supports options is useful only if you are using twig functions ('workflow_*')
84
85
supports :
85
86
- App\Entity\PullRequest
86
87
initial_marking : start
@@ -132,6 +133,7 @@ Below is the configuration for the pull request state machine.
132
133
<framework : property >currentPlace</framework : property >
133
134
</framework : marking-store >
134
135
136
+ <!-- The supports options is useful only if you are using twig functions ('workflow_*') -->
135
137
<framework : support >App\Entity\PullRequest</framework : support >
136
138
137
139
<framework : initial_marking >start</framework : initial_marking >
@@ -202,6 +204,7 @@ Below is the configuration for the pull request state machine.
202
204
203
205
$pullRequest
204
206
->type('state_machine')
207
+ // The supports options is useful only if you are using twig functions ('workflow_*')
205
208
->supports(['App\Entity\PullRequest'])
206
209
->initialMarking(['start']);
207
210
@@ -252,33 +255,6 @@ Below is the configuration for the pull request state machine.
252
255
->to(['review']);
253
256
};
254
257
255
- In a Symfony application using the
256
- :ref: `default services.yaml configuration <service-container-services-load-example >`,
257
- you can get this state machine by injecting the Workflow registry service::
258
-
259
- // ...
260
- use App\Entity\PullRequest;
261
- use Symfony\Component\Workflow\Registry;
262
-
263
- class SomeService
264
- {
265
- private $workflows;
266
-
267
- public function __construct(Registry $workflows)
268
- {
269
- $this->workflows = $workflows;
270
- }
271
-
272
- public function someMethod(PullRequest $pullRequest)
273
- {
274
- $stateMachine = $this->workflows->get($pullRequest, 'pull_request');
275
- $stateMachine->apply($pullRequest, 'wait_for_review');
276
- // ...
277
- }
278
-
279
- // ...
280
- }
281
-
282
258
Symfony automatically creates a service for each workflow (:class: `Symfony\\ Component\\ Workflow\\ Workflow `)
283
259
or state machine (:class: `Symfony\\ Component\\ Workflow\\ StateMachine `) you
284
260
have defined in your configuration. This means that you can use ``workflow.pull_request ``
0 commit comments