@@ -553,7 +553,8 @@ requires:
553
553
framework :
554
554
workflows :
555
555
blog_publishing :
556
- metadata : ' Blog Publishing Workflow'
556
+ metadata :
557
+ title : ' Blog Publishing Workflow'
557
558
# ...
558
559
places :
559
560
draft :
@@ -580,7 +581,7 @@ requires:
580
581
>
581
582
582
583
<framework : config >
583
- <framework : workflow name =" blog_publishing" type = " workflow " >
584
+ <framework : workflow name =" blog_publishing" >
584
585
<framework : metadata >
585
586
<framework : title >Blog Publishing Workflow</framework : title >
586
587
</framework : metadata >
@@ -646,9 +647,6 @@ In your Controller::
646
647
{
647
648
$workflow = $registry->get($article);
648
649
649
- // Or, if you don't inject the Workflow Registry, fetch from the Container:
650
- $workflow = $this->get('workflow.article');
651
-
652
650
$workflow
653
651
->getMetadataStore()
654
652
->getWorkflowMetadata()['title'] ?? false
@@ -678,8 +676,9 @@ There is a shortcut that works with everything::
678
676
In a Flash message in your Controller::
679
677
680
678
// $transition = ...; (an instance of Transition)
681
- $title = $this->get('workflow.article')->getMetadataStore()->getMetadata('title', $transition);
682
- $request->getSession()->getFlashBag()->add('info', "You have successfully applied the transition with title: '$title'");
679
+ // $workflow is a WorkFlow instance retrieved from the Registry (see above)
680
+ $title = $workflow->getMetadataStore()->getMetadata('title', $transition);
681
+ $this->addFlash('info', "You have successfully applied the transition with title: '$title'");
683
682
684
683
In a listener, access via the Event::
685
684
@@ -691,7 +690,7 @@ In a listener, access via the Event::
691
690
use Symfony\Component\Workflow\Event\GuardEvent;
692
691
use Symfony\Component\Workflow\TransitionBlocker;
693
692
694
- class DoneGuard implements EventSubscriberInterface
693
+ class OverdueGuard implements EventSubscriberInterface
695
694
{
696
695
public function guardPublish(GuardEvent $event)
697
696
{
@@ -717,7 +716,7 @@ In a listener, access via the Event::
717
716
718
717
In Twig templates, metadata is available via the ``workflow_metadata() `` function:
719
718
720
- .. code-block :: twig
719
+ .. code-block :: html+ twig
721
720
722
721
<h2>Metadata</h2>
723
722
<p>
0 commit comments