Skip to content

Fixing retrieving metadata examples #11473

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

Closed
wants to merge 4 commits into from
Closed
Changes from 2 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
13 changes: 8 additions & 5 deletions workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -612,21 +612,24 @@ Then you can access this metadata in your controller as follows::
;

// or
$title = $workflow->getMetadataStore()
->getWorkflowMetadata()['title'] ?? false
$maxNumOfWords = $workflow->getMetadataStore()
->getPlaceMetadata('draft')['max_num_of_words'] ?? false
;

// or
$aTransition = $workflow->getDefinition()->getTransitions()[0];
$transitionTitle = $workflow
$priority = $workflow
->getMetadataStore()
->getTransitionMetadata($aTransition)['title'] ?? false
->getTransitionMetadata($aTransition)['priority'] ?? false
;
}

There is a shortcut that works with everything::

$title = $workflow->getMetadataStore()->getMetadata('title');
$title = $workflow->getMetadataStore()->getMetadata()['title'];
$maxNumOfWords = $workflow->getMetadataStore()->getMetadata('draft')['max_num_of_words'];
$priority = $workflow->getMetadataStore()->getMetadata($aTransition)['priority'];


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

Expand Down