File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -198,11 +198,17 @@ you can get this state machine by injecting the Workflow registry service::
198198
199199 class SomeService
200200 {
201- private $stateMachine ;
201+ private $workflows ;
202202
203203 public function __constructor(Registry $workflows)
204204 {
205- $this->stateMachine = $workflows->get('pull_request');
205+ $this->workflows = $workflows;
206+ }
207+
208+ public function someMethod()
209+ {
210+ $stateMachine = $this->workflows->get('pull_request');
211+ // ...
206212 }
207213
208214 // ...
Original file line number Diff line number Diff line change @@ -170,12 +170,13 @@ you can get the workflow by injecting the Workflow registry service::
170170
171171 // ...
172172 use Symfony\Component\Workflow\Registry;
173+ use App\Entity\BlogPost;
173174
174175 class BlogController
175176 {
176177 public function edit(Registry $workflows)
177178 {
178- $post = new \App\Entity\ BlogPost();
179+ $post = new BlogPost();
179180 $workflow = $workflows->get($post);
180181
181182 // if there are multiple workflows for the same class,
@@ -192,7 +193,7 @@ you can get the workflow by injecting the Workflow registry service::
192193 // ...
193194 }
194195
195- // See all the available transition for the post in the current state
196+ // See all the available transitions for the post in the current state
196197 $transitions = $workflow->getEnabledTransitions($post);
197198 }
198199 }
@@ -272,7 +273,7 @@ order:
272273 * ``workflow.[workflow name].announce ``
273274 * ``workflow.[workflow name].announce.[transition name] ``
274275
275- Here is an example how to enable logging for every time the ``blog_publishing ``
276+ Here is an example of how to enable logging for every time the ``blog_publishing ``
276277workflow leaves a place::
277278
278279 use Psr\Log\LoggerInterface;
You can’t perform that action at this time.
0 commit comments