File tree Expand file tree Collapse file tree 3 files changed +57
-55
lines changed Expand file tree Collapse file tree 3 files changed +57
-55
lines changed Original file line number Diff line number Diff line change @@ -79,10 +79,11 @@ Usage
7979-----
8080
8181When you have configured a ``Registry `` with your workflows,
82- you can retrieve a workflow from it and use it as follows::
82+ you can retreive a workflow from it and use it as follows::
8383
8484 // ...
8585 // Consider that $blogPost is in place "draft" by default
86+ // Consider that $post is in state "draft" by default
8687 $blogPost = new BlogPost();
8788 $workflow = $registry->get($blogPost);
8889
Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ what actions are allowed on a blog post::
182182 use App\Entity\BlogPost;
183183 use Symfony\Component\Workflow\Exception\LogicException;
184184
185- $post = BlogPost();
185+ $post = new BlogPost();
186186
187187 $workflow = $this->container->get('workflow.blog_publishing');
188188 $workflow->can($post, 'publish'); // False
@@ -664,6 +664,7 @@ Then you can access this metadata in your controller as follows::
664664
665665 use App\Entity\BlogPost;
666666 use Symfony\Component\Workflow\Registry;
667+ use App\Entity\BlogPost;
667668
668669 public function myController(Registry $registry, BlogPost $post)
669670 {
Original file line number Diff line number Diff line change @@ -228,63 +228,63 @@ Below is the configuration for the pull request state machine with styling added
228228 // ...
229229 'workflows' => [
230230 'pull_request' => [
231- 'type' => 'state_machine',
232- 'supports' => ['App\Entity\PullRequest'],
233- 'places' => [
234- 'start',
235- 'coding',
236- 'test',
237- 'review' => [
238- 'metadata' => [
239- 'description' => 'Human review',
231+ 'type' => 'state_machine',
232+ 'supports' => ['App\Entity\PullRequest'],
233+ 'places' => [
234+ 'start',
235+ 'coding',
236+ 'test',
237+ 'review' => [
238+ 'metadata' => [
239+ 'description' => 'Human review',
240+ ],
240241 ],
241- ] ,
242- 'merged',
243- 'closed ' => [
244- 'metadata ' => [
245- 'bg_color' => 'DeepSkyBlue' ,
242+ 'merged' ,
243+ 'closed' => [
244+ 'metadata ' => [
245+ 'bg_color ' => 'DeepSkyBlue',
246+ ] ,
246247 ],
247248 ],
248- ],
249- 'transitions' => [
250- 'submit' => [
251- 'from ' => 'start ',
252- 'to' => 'test' ,
253- ],
254- 'update' => [
255- 'from ' => ['coding', ' test', 'review'] ,
256- 'to ' => 'test',
257- 'metadata ' => [
258- 'arrow_color' => 'Turquoise' ,
259- ],
260- ],
261- 'wait_for_review' => [
262- 'from ' => 'test ',
263- 'to ' => 'review',
264- 'metadata ' => [
265- 'color' => 'Orange' ,
266- ],
267- ],
268- 'request_change' => [
269- 'from ' => 'review ',
270- 'to' => 'coding' ,
271- ],
272- 'accept' => [
273- 'from ' => 'review ',
274- 'to ' => 'merged',
275- 'metadata ' => [
276- 'label' => 'Accept PR' ,
277- ],
278- ],
279- 'reject' => [
280- 'from ' => 'review ',
281- 'to' => 'closed' ,
282- ],
283- 'reopen' => [
284- 'from ' => 'start ',
285- 'to' => 'review' ,
249+ 'transitions' => [
250+ 'submit' => [
251+ 'from' => 'start',
252+ 'to ' => 'test ',
253+ ] ,
254+ 'update'=> [
255+ 'from' => ['coding', 'test', 'review'],
256+ 'to ' => ' test',
257+ 'metadata ' => [
258+ 'arrow_color ' => 'Turquoise',
259+ ] ,
260+ ],
261+ 'wait_for_review'=> [
262+ 'from' => 'test',
263+ 'to ' => 'review ',
264+ 'metadata ' => [
265+ 'color ' => 'Orange',
266+ ] ,
267+ ],
268+ 'request_change'=> [
269+ 'from' => 'review',
270+ 'to ' => 'coding ',
271+ ] ,
272+ 'accept'=> [
273+ 'from' => 'review',
274+ 'to ' => 'merged ',
275+ 'metadata ' => [
276+ 'label ' => 'Accept PR',
277+ ] ,
278+ ],
279+ 'reject'=> [
280+ 'from' => 'review',
281+ 'to ' => 'closed ',
282+ ] ,
283+ 'reopen'=> [
284+ 'from' => 'start',
285+ 'to ' => 'review ',
286+ ] ,
286287 ],
287- ],
288288 ],
289289 ],
290290 ]);
You can’t perform that action at this time.
0 commit comments