`, which allows you to implement
+any desired feature.
+
+Another one is via the configuration and its specific entry ``guard`` on a transition.
+
+This ``guard`` entry allows any expression that is valid for the Expression Language component:
+
+.. configuration-block::
+
+ .. code-block:: yaml
+
+ # config/packages/workflow.yaml
+ framework:
+ workflows:
+ blog_publishing:
+ # previous configuration
+ transitions:
+ to_review:
+ # the transition is allowed only if the current user has the ROLE_REVIEWER role.
+ guard: "is_granted('ROLE_REVIEWER')"
+ from: draft
+ to: reviewed
+ publish:
+ # or "is_anonymous", "is_remember_me", "is_fully_authenticated", "is_granted"
+ guard: "is_authenticated"
+ from: reviewed
+ to: published
+ reject:
+ # or any valid expression language with "subject" refering to the post
+ guard: "has_role("ROLE_ADMIN") and subject.isStatusReviewed()"
+ from: reviewed
+ to: rejected
+
Usage in Twig
-------------
@@ -542,7 +587,7 @@ The following example shows these functions in action:
{% endfor %}
{# Check if the object is in some specific place #}
- {% if workflow_has_marked_place(post, 'review') %}
+ {% if workflow_has_marked_place(post, 'reviewed') %}
This post is ready for review.
{% endif %}