Skip to content

Commit e4fd90c

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: [Workflow] pass arguments to getMetadata method
2 parents e808ae1 + e9c6102 commit e4fd90c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

workflow.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ of domain logic in your templates:
665665

666666
``workflow_has_marked_place()``
667667
Returns ``true`` if the marking of the given object has the given state.
668-
668+
669669
``workflow_transition_blockers()``
670670
Returns :class:`Symfony\\Component\\Workflow\\TransitionBlockerList` for the given transition.
671671

@@ -700,7 +700,7 @@ The following example shows these functions in action:
700700
{% if 'reviewed' in workflow_marked_places(post) %}
701701
<span class="label">Reviewed</span>
702702
{% endif %}
703-
703+
704704
{# Loop through the transition blockers #}
705705
{% for blocker in workflow_transition_blockers(post, 'publish') %}
706706
<span class="error">{{ blocker.message }}</span>
@@ -856,14 +856,14 @@ Then you can access this metadata in your controller as follows::
856856

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

859-
// pass no arguments to getMetadata() to get "workflow metadata"
860-
$title = $workflow->getMetadataStore()->getMetadata()['title'];
859+
// get "workflow metadata" passing the metadata key as argument
860+
$title = $workflow->getMetadataStore()->getMetadata('title');
861861

862-
// pass a string (the place name) to getMetadata() to get "place metadata"
863-
$maxNumOfWords = $workflow->getMetadataStore()->getMetadata('draft')['max_num_of_words'];
862+
// get "place metadata" passing the metadata key as the first argument and the place name as the second argument
863+
$maxNumOfWords = $workflow->getMetadataStore()->getMetadata('max_num_of_words', 'draft');
864864

865-
// pass a Transition object to getMetadata() to get "transition metadata"
866-
$priority = $workflow->getMetadataStore()->getMetadata($aTransition)['priority'];
865+
// get "transition metadata" passing the metadata key as the first argument and a Transition object as the second argument
866+
$priority = $workflow->getMetadataStore()->getMetadata('priority', $aTransition);
867867

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

0 commit comments

Comments
 (0)