@@ -17,11 +17,12 @@ install the workflow feature before using it:
17
17
Configuration
18
18
-------------
19
19
20
- To see all configuration options, if you are using the component inside a Symfony project run this command:
20
+ To see all configuration options, if you are using the component inside a
21
+ Symfony project run this command:
21
22
22
23
.. code-block :: terminal
23
24
24
- $ bin/console config:dump-reference framework workflows
25
+ $ php bin/console config:dump-reference framework workflows
25
26
26
27
Creating a Workflow
27
28
-------------------
@@ -670,36 +671,33 @@ requires:
670
671
671
672
Then you can access this metadata in your controller as follows::
672
673
673
- public function myControllerAction (Registry $registry, Article $article)
674
+ public function myController (Registry $registry, Article $article)
674
675
{
675
676
$workflow = $registry->get($article);
676
677
677
- $workflow
678
+ $title = $ workflow
678
679
->getMetadataStore()
679
680
->getWorkflowMetadata()['title'] ?? false
680
681
;
681
682
682
683
// or
683
- $workflow->getMetadataStore()
684
+ $title = $ workflow->getMetadataStore()
684
685
->getWorkflowMetadata()['title'] ?? false
685
686
;
686
687
687
688
// or
688
689
$aTransition = $workflow->getDefinition()->getTransitions()[0];
689
- $workflow
690
+ $transitionTitle = $ workflow
690
691
->getMetadataStore()
691
692
->getTransitionMetadata($aTransition)['title'] ?? false
692
693
;
693
694
}
694
695
695
696
There is a shortcut that works with everything::
696
697
697
- $workflow
698
- ->getMetadataStore()
699
- ->getMetadata('title')
700
- ;
698
+ $title = $workflow->getMetadataStore()->getMetadata('title');
701
699
702
- In a Flash message in your Controller ::
700
+ In a :ref: ` flash message < flash-messages >` in your controller ::
703
701
704
702
// $transition = ...; (an instance of Transition)
705
703
@@ -709,15 +707,16 @@ In a Flash message in your Controller::
709
707
710
708
Metadata can also be accessed in a Listener, from the Event object.
711
709
712
- Using transition blockers you can
713
- return a user-friendly error message when you stop a transition from happening. In the example we
714
- get this message from the :class: `Symfony\\ Component\\ Workflow\\ Event\\ Event `'s metadata, giving
715
- you a central place to manage the text.
710
+ Using transition blockers you can return a user-friendly error message when you
711
+ stop a transition from happening. The example gets this message from the
712
+ :class: `Symfony\\ Component\\ Workflow\\ Event\\ Event `'s metadata, giving you a
713
+ central place to manage the text.
716
714
717
715
.. tip ::
718
716
719
- This example has been simplified; in production you may prefer to use the :doc: `Translation </components/translation >`
720
- component to manage messages in one place::
717
+ This example has been simplified; in production you may prefer to use the
718
+ :doc: `Translation </components/translation >` component to manage messages in
719
+ one place::
721
720
722
721
namespace App\Listener\Workflow\Task;
723
722
0 commit comments