Details
-
Bug
-
Resolution: Won't Fix
-
Medium
-
3.2.2
Description
If you have a workflow with stages : first, second, third, fouth:
If you then make a guard on the "to_second" transition, it will be triggered when editing the object in "first" stage ( ie. when you are editing the draft the first time )
Expected behavior : event should be triggered when you try to send it to the second stage in the workflow
I am pretty sure this worked on some 3.1.x version ( or 3.0 ). Experiencing this now on 3.2.2
config :
system: # Workflow configuration is SiteAccess-aware default: workflows: # Identifier of the workflow custom_workflow: name: Custom Workflow matchers: # Which Content Types can use this workflow, optional # content_type: article # Which status of the Content item can use this workflow, optional. Available statuses are draft and published. content_status: draft # All stages the content goes through stages: first: label: First stage color: '#f15a10' second: label: Second stage color: '#5a10f1' third: label: Third stage color: '#301203' fourth: label: Fourth stage color: '#5b8930' # Content items in this stage don't appear on My dashboard and in Review Queue. last_stage: true initial_stage: first # Available transitions between stages transitions: to_second: from: first to: second label: Are you sure ? color: '#8888ba' icon: '/bundles/ezplatformadminui/img/ez-icons.svg#comment' reviewers: required: true # actions: # to_second_stage_transition_action: back_to_first: reverse: to_second label: I'm not sure color: '#cb8888' icon: '/bundles/ezplatformadminui/img/ez-icons.svg#comment' to_third: from: second to: third label: Are you really sure ? color: '#8888ba' icon: '/bundles/ezplatformadminui/img/ez-icons.svg#comment' reviewers: required: true back_to_second: reverse: to_third label: I'm not really sure color: '#cb8888' icon: '/bundles/ezplatformadminui/img/ez-icons.svg#comment' done: from: third to: fourth label: Publish if you are really really sure ! color: '#88ad88' icon: '/bundles/ezplatformadminui/img/ez-icons.svg#comment' actions: publish: ~
event handler
<?php namespace EzSystems\RepositoryEventsBundle\EventSubscriber; use eZ\Publish\API\Repository\Values\Content\Content; use EzSystems\EzPlatformAdminUi\Notification\NotificationHandlerInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Workflow\Event\GuardEvent; class BikeRideWorkflowSubscriber implements EventSubscriberInterface { /** * @var NotificationHandlerInterface */ private $notificationHandler; public function __construct(NotificationHandlerInterface $notificationHandler) { $this->notificationHandler = $notificationHandler; } public function guardReview(GuardEvent $event) { //var_dump("froms", $event->getTransition()->getFroms(), "tos", $event->getTransition()->getTos()); //var_dump(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)); $content = $event->getSubject(); if ($content instanceof Content) { $this->notificationHandler->error( 'By mistake, you get this message when editing the content the first time' ); // $event->setBlocked(true); } } public static function getSubscribedEvents() { return [ 'workflow.custom_workflow.guard.to_second' => ['guardReview'], ]; } }