Skip to content

[Workflow] pass arguments to getMetadata method #14151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -858,14 +858,14 @@ Then you can access this metadata in your controller as follows::

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

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

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

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

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

Expand Down