8000 Documented the workflow metadata [redux] by pbowyer · Pull Request #11209 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Documented the workflow metadata [redux] #11209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Apr 17, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Incorporate further excellent feedback from @HeahDude
  • Loading branch information
pbowyer committed Apr 7, 2019
commit ea649921e5f70e8310d644f57fe6262d1840047a
12 changes: 6 additions & 6 deletions workflow/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -688,15 +688,13 @@ In a Flash message in your Controller::
$title = $workflow->getMetadataStore()->getMetadata('title', $transition);
$this->addFlash('info', "You have successfully applied the transition with title: '$title'");

In a listener, access via the Event

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

The example below uses a new feature introduced in 4.1 called Transition Blockers. These let you
Using transition blockers you can
return a user-friendly error message when you stop a transition from happening. In the example we
get this user-friendly message from the Event's metadata, giving you an easy place to manage the
text. This is a contrived e AE76 xample; in production systems you may prefer to use the
:doc:`Translation </components/translation>` component to manage text::
get this message from the :class:`Symfony\\Component\\Workflow\\Event\\Event`'s metadata, giving
you an easy place to manage the text. This is a contrived example; in production code you may
prefer to use the :doc:`Translation </components/translation>` component to manage messages::

namespace App\Listener\Workflow\Task;

Expand Down Expand Up @@ -726,7 +724,9 @@ text. This is a contrived example; in production systems you may prefer to use t
}
}

.. versionadded:: 4.1

The transition blockers were added in version 4.1.

In Twig templates, metadata is available via the ``workflow_metadata()`` function:

Expand Down
0