File tree 3 files changed +57
-55
lines changed
3 files changed +57
-55
lines changed Original file line number Diff line number Diff line change @@ -79,10 +79,11 @@ Usage
79
79
-----
80
80
81
81
When 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::
83
83
84
84
// ...
85
85
// Consider that $blogPost is in place "draft" by default
86
+ // Consider that $post is in state "draft" by default
86
87
$blogPost = new BlogPost();
87
88
$workflow = $registry->get($blogPost);
88
89
Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ what actions are allowed on a blog post::
182
182
use App\Entity\BlogPost;
183
183
use Symfony\Component\Workflow\Exception\LogicException;
184
184
185
- $post = BlogPost();
185
+ $post = new BlogPost();
186
186
187
187
$workflow = $this->container->get('workflow.blog_publishing');
188
188
$workflow->can($post, 'publish'); // False
@@ -664,6 +664,7 @@ Then you can access this metadata in your controller as follows::
664
664
665
665
use App\Entity\BlogPost;
666
666
use Symfony\Component\Workflow\Registry;
667
+ use App\Entity\BlogPost;
667
668
668
669
public function myController(Registry $registry, BlogPost $post)
669
670
{
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
228
228
// ...
229
229
'workflows' => [
230
230
'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
+ ],
240
241
],
241
- ] ,
242
- 'merged',
243
- 'closed ' => [
244
- 'metadata ' => [
245
- 'bg_color' => 'DeepSkyBlue' ,
242
+ 'merged' ,
243
+ 'closed' => [
244
+ 'metadata ' => [
245
+ 'bg_color ' => 'DeepSkyBlue',
246
+ ] ,
246
247
],
247
248
],
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
+ ] ,
286
287
],
287
- ],
288
288
],
289
289
],
290
290
]);
You can’t perform that action at this time.
0 commit comments