Skip to content

Commit b1487e3

Browse files
committed
minor #14151 [Workflow] pass arguments to getMetadata method (lubo13)
This PR was submitted for the 5.1 branch but it was squashed and merged into the 4.4 branch instead. Discussion ---------- [Workflow] pass arguments to getMetadata method By my opinion and the code in a trait, I saw that to the getMetadata method we should pass two arguments. But the first should be the key from metadata and the second should be null (for workflow's metadata), string (for place's metadata) or instance of Transition (for transition's metadata) Commits ------- 8b36b82 [Workflow] pass arguments to getMetadata method
2 parents 0beb1b0 + 8b36b82 commit b1487e3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

workflow.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -858,14 +858,14 @@ Then you can access this metadata in your controller as follows::
858858

859859
There is a ``getMetadata()`` method that works with all kinds of metadata::
860860

861-
// pass no arguments to getMetadata() to get "workflow metadata"
862-
$title = $workflow->getMetadataStore()->getMetadata()['title'];
861+
// pass a string (the key of workflow metadata) to getMetadata() to get "workflow metadata" by key
862+
$title = $workflow->getMetadataStore()->getMetadata('title');
863863

864-
// pass a string (the place name) to getMetadata() to get "place metadata"
865-
$maxNumOfWords = $workflow->getMetadataStore()->getMetadata('draft')['max_num_of_words'];
864+
// pass two arguments: a string (the key of place metadata) and a string (the place name) to getMetadata() to get "place metadata" by key
865+
$maxNumOfWords = $workflow->getMetadataStore()->getMetadata('max_num_of_words', 'draft');
866866

867-
// pass a Transition object to getMetadata() to get "transition metadata"
868-
$priority = $workflow->getMetadataStore()->getMetadata($aTransition)['priority'];
867+
// pass two arguments: a string (the key of transition metadata) and a Transition object to getMetadata() to get "transition metadata" by key
868+
$priority = $workflow->getMetadataStore()->getMetadata('priority', $aTransition);
869869

870870
In a :ref:`flash message <flash-messages>` in your controller::
871871

0 commit comments

Comments
 (0)