File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -455,6 +455,7 @@ Storing Metadata
455
455
----------------
456
456
457
457
.. versionadded :: 4.1
458
+
458
459
The feature to store metadata in workflows was introduced in Symfony 4.1.
459
460
460
461
In case you need it, you can store arbitrary metadata in workflows, their
@@ -556,9 +557,7 @@ requires:
556
557
),
557
558
));
558
559
559
- Then, you can access this metadata in your PHP code as follows:
560
-
561
- In your Controller::
560
+ Then you can access this metadata in your controller as follows::
562
561
563
562
public function myControllerAction(Registry $registry, Article $article)
564
563
{
@@ -593,14 +592,12 @@ There is a shortcut that works with everything::
593
592
In a Flash message in your Controller::
594
593
595
594
// $transition = ...; (an instance of Transition)
596
- // $workflow is a WorkFlow instance retrieved from the Registry (see above)
595
+ // $workflow is a Workflow instance retrieved from the Registry (see above)
597
596
$title = $workflow->getMetadataStore()->getMetadata('title', $transition);
598
597
$this->addFlash('info', "You have successfully applied the transition with title: '$title'");
599
598
600
599
In a listener, access via the Event::
601
600
602
- <?php
603
-
604
601
namespace App\Listener\Workflow\Task;
605
602
606
603
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
You can’t perform that action at this time.
0 commit comments