File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -496,6 +496,7 @@ workflow leaves a place::
496
496
use Psr\Log\LoggerInterface;
497
497
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
498
498
use Symfony\Component\Workflow\Event\Event;
499
+ use Symfony\Component\Workflow\Event\LeaveEvent;
499
500
500
501
class WorkflowLoggerSubscriber implements EventSubscriberInterface
501
502
{
@@ -518,11 +519,24 @@ workflow leaves a place::
518
519
public static function getSubscribedEvents(): array
519
520
{
520
521
return [
521
- 'workflow. blog_publishing.leave' => 'onLeave',
522
+ LeaveEvent::getName(' blog_publishing') => 'onLeave',
522
523
];
523
524
}
524
525
}
525
526
527
+ .. tip ::
528
+
529
+ All built-in workflow events define the ``getName(?string $workflowName, ?string $transitionOrPlaceName) ``
530
+ method to build the full event name (e.g. ``'workflow.blog_publishing.leave' ``)
531
+ without having to work with strings.
532
+
533
+ You can also use this method in your custom events via the
534
+ :class: `Symfony\\ Component\\ Workflow\\ Event\\ EventNameTrait `.
535
+
536
+ .. versionadded :: 7.1
537
+
538
+ The ``getName() `` method was introduced in Symfony 7.1.
539
+
526
540
If some listeners update the context during a transition, you can retrieve
527
541
it via the marking::
528
542
You can’t perform that action at this time.
0 commit comments