Skip to content

Commit d926caa

Browse files
committed
First set of tidy-ups for @HeahDude's feedback.
1 parent 349fb94 commit d926caa

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

workflow/usage.rst

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,8 @@ requires:
470470
framework:
471471
workflows:
472472
blog_publishing:
473-
metadata: 'Blog Publishing Workflow'
473+
metadata:
474+
title: 'Blog Publishing Workflow'
474475
# ...
475476
places:
476477
draft:
@@ -497,7 +498,7 @@ requires:
497498
>
498499
499500
<framework:config>
500-
<framework:workflow name="blog_publishing" type="workflow">
501+
<framework:workflow name="blog_publishing">
501502
<framework:metadata>
502503
<framework:title>Blog Publishing Workflow</framework:title>
503504
</framework:metadata>
@@ -563,9 +564,6 @@ In your Controller::
563564
{
564565
$workflow = $registry->get($article);
565566

566-
// Or, if you don't inject the Workflow Registry, fetch from the Container:
567-
$workflow = $this->get('workflow.article');
568-
569567
$workflow
570568
->getMetadataStore()
571569
->getWorkflowMetadata()['title'] ?? false
@@ -595,8 +593,9 @@ There is a shortcut that works with everything::
595593
In a Flash message in your Controller::
596594

597595
// $transition = ...; (an instance of Transition)
598-
$title = $this->get('workflow.article')->getMetadataStore()->getMetadata('title', $transition);
599-
$request->getSession()->getFlashBag()->add('info', "You have successfully applied the transition with title: '$title'");
596+
// $workflow is a WorkFlow instance retrieved from the Registry (see above)
597+
$title = $workflow->getMetadataStore()->getMetadata('title', $transition);
598+
$this->addFlash('info', "You have successfully applied the transition with title: '$title'");
600599

601600
In a listener, access via the Event::
602601

@@ -608,7 +607,7 @@ In a listener, access via the Event::
608607
use Symfony\Component\Workflow\Event\GuardEvent;
609608
use Symfony\Component\Workflow\TransitionBlocker;
610609

611-
class DoneGuard implements EventSubscriberInterface
610+
class OverdueGuard implements EventSubscriberInterface
612611
{
613612
public function guardPublish(GuardEvent $event)
614613
{
@@ -634,7 +633,7 @@ In a listener, access via the Event::
634633

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

637-
.. code-block:: twig
636+
.. code-block:: html+twig
638637

639638
<h2>Metadata</h2>
640639
<p>

0 commit comments

Comments
 (0)