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 @@ -538,6 +538,7 @@ Storing Metadata
538
538
----------------
539
539
540
540
.. versionadded :: 4.1
541
+
541
542
The feature to store metadata in workflows was introduced in Symfony 4.1.
542
543
543
544
In case you need it, you can store arbitrary metadata in workflows, their
@@ -639,9 +640,7 @@ requires:
639
640
),
640
641
));
641
642
642
- Then, you can access this metadata in your PHP code as follows:
643
-
644
- In your Controller::
643
+ Then you can access this metadata in your controller as follows::
645
644
646
645
public function myControllerAction(Registry $registry, Article $article)
647
646
{
@@ -676,14 +675,12 @@ There is a shortcut that works with everything::
676
675
In a Flash message in your Controller::
677
676
678
677
// $transition = ...; (an instance of Transition)
679
- // $workflow is a WorkFlow instance retrieved from the Registry (see above)
678
+ // $workflow is a Workflow instance retrieved from the Registry (see above)
680
679
$title = $workflow->getMetadataStore()->getMetadata('title', $transition);
681
680
$this->addFlash('info', "You have successfully applied the transition with title: '$title'");
682
681
683
682
In a listener, access via the Event::
684
683
685
- <?php
686
-
687
684
namespace App\Listener\Workflow\Task;
688
685
689
686
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
You can’t perform that action at this time.
0 commit comments