Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ad961c7

Browse filesBrowse files
committed
Minor rewords
1 parent 3456cc0 commit ad961c7
Copy full SHA for ad961c7

File tree

Expand file treeCollapse file tree

1 file changed

+16
-17
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-17
lines changed

‎workflow/usage.rst

Copy file name to clipboardExpand all lines: workflow/usage.rst
+16-17Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ install the workflow feature before using it:
1717
Configuration
1818
-------------
1919

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:
2122

2223
.. code-block:: terminal
2324
24-
$ bin/console config:dump-reference framework workflows
25+
$ php bin/console config:dump-reference framework workflows
2526
2627
Creating a Workflow
2728
-------------------
@@ -670,36 +671,33 @@ requires:
670671
671672
Then you can access this metadata in your controller as follows::
672673

673-
public function myControllerAction(Registry $registry, Article $article)
674+
public function myController(Registry $registry, Article $article)
674675
{
675676
$workflow = $registry->get($article);
676677

677-
$workflow
678+
$title = $workflow
678679
->getMetadataStore()
679680
->getWorkflowMetadata()['title'] ?? false
680681
;
681682

682683
// or
683-
$workflow->getMetadataStore()
684+
$title = $workflow->getMetadataStore()
684685
->getWorkflowMetadata()['title'] ?? false
685686
;
686687

687688
// or
688689
$aTransition = $workflow->getDefinition()->getTransitions()[0];
689-
$workflow
690+
$transitionTitle = $workflow
690691
->getMetadataStore()
691692
->getTransitionMetadata($aTransition)['title'] ?? false
692693
;
693694
}
694695

695696
There is a shortcut that works with everything::
696697

697-
$workflow
698-
->getMetadataStore()
699-
->getMetadata('title')
700-
;
698+
$title = $workflow->getMetadataStore()->getMetadata('title');
701699

702-
In a Flash message in your Controller::
700+
In a :ref:`flash message <flash-messages>` in your controller::
703701

704702
// $transition = ...; (an instance of Transition)
705703

@@ -709,15 +707,16 @@ In a Flash message in your Controller::
709707

710708
Metadata can also be accessed in a Listener, from the Event object.
711709

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.
716714

717715
.. tip::
718716

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::
721720

722721
namespace App\Listener\Workflow\Task;
723722

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.