@@ -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 options is useful only if you are using twig functions ('workflow_*')
8485 supports :
8586 - App\Entity\PullRequest
8687 initial_marking : start
@@ -132,6 +133,7 @@ Below is the configuration for the pull request state machine.
132133 <framework : property >currentPlace</framework : property >
133134 </framework : marking-store >
134135
136+ <!-- The supports options is useful only if you are using twig functions ('workflow_*') -->
135137 <framework : support >App\Entity\PullRequest</framework : support >
136138
137139 <framework : initial_marking >start</framework : initial_marking >
@@ -202,6 +204,7 @@ Below is the configuration for the pull request state machine.
202204
203205 $pullRequest
204206 ->type('state_machine')
207+ // The supports options is useful only if you are using twig functions ('workflow_*')
205208 ->supports(['App\Entity\PullRequest'])
206209 ->initialMarking(['start']);
207210
@@ -252,33 +255,6 @@ Below is the configuration for the pull request state machine.
252255 ->to(['review']);
253256 };
254257
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-
282258 Symfony automatically creates a service for each workflow (:class: `Symfony\\ Component\\ Workflow\\ Workflow `)
283259or state machine (:class: `Symfony\\ Component\\ Workflow\\ StateMachine `) you
284260have defined in your configuration. This means that you can use ``workflow.pull_request ``
0 commit comments