@@ -537,34 +537,34 @@ requires:
537
537
538
538
// config/packages/workflow.php
539
539
540
- $container->loadFromExtension('framework', [
541
- // ...
542
- 'workflows' => [
543
- 'blog_publishing' => [
544
- 'metadata' => [
545
- 'title' => 'Blog Publishing Workflow',
546
- ],
540
+ $container->loadFromExtension('framework', [
547
541
// ...
548
- 'places ' => [
549
- 'draft ' => [
542
+ 'workflows ' => [
543
+ 'blog_publishing ' => [
550
544
'metadata' => [
551
- 'max_num_of_words ' => 500 ,
545
+ 'title ' => 'Blog Publishing Workflow' ,
552
546
],
553
- ],
554
- // ...
555
- ],
556
- 'transitions' => [
557
- 'to_review' => [
558
- 'from' => 'draft',
559
- 'to' => 'review',
560
- 'metadata' => [
561
- 'priority' => 0.5,
547
+ // ...
548
+ 'places' => [
549
+ 'draft' => [
550
+ 'metadata' => [
551
+ 'max_num_of_words' => 500,
552
+ ],
553
+ ],
554
+ // ...
555
+ ],
556
+ 'transitions' => [
557
+ 'to_review' => [
558
+ 'from' => 'draft',
559
+ 'to' => 'review',
560
+ 'metadata' => [
561
+ 'priority' => 0.5,
562
+ ],
563
+ ],
562
564
],
563
565
],
564
566
],
565
- ],
566
- ],
567
- ]);
567
+ ]);
568
568
569
569
Then you can access this metadata in your controller as follows::
570
570
@@ -610,12 +610,12 @@ Metadata can also be accessed in a Listener, from the Event object.
610
610
Using transition blockers you can
611
611
return a user-friendly error message when you stop a transition from happening. In the example we
612
612
get this message from the :class: `Symfony\\ Component\\ Workflow\\ Event\\ Event `'s metadata, giving
613
- you an easy place to manage the text.
613
+ you a central place to manage the text.
614
614
615
615
.. tip ::
616
616
617
- This is a simple example; in production you may prefer to use the :doc: `Translation </components/translation >`
618
- component to manage messages in one place::
617
+ This is a simple example; in production you may prefer to use the :doc: `Translation </components/translation >`
618
+ component to manage messages in one place::
619
619
620
620
namespace App\L istener\W orkflow\T ask;
621
621
@@ -647,7 +647,7 @@ component to manage messages in one place::
647
647
648
648
.. versionadded :: 4.1
649
649
650
- The transition blockers were added in version 4.1.
650
+ The transition blockers were introduced in version 4.1.
651
651
652
652
In Twig templates, metadata is available via the ``workflow_metadata() `` function:
653
653
0 commit comments