Skip to content

Commit 8146730

Browse files
committed
gracefully handle missing event dispatchers
1 parent 8bdd695 commit 8146730

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Workflow.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ public function __construct(Definition $definition, MarkingStoreInterface $marki
4343
{
4444
$this->definition = $definition;
4545
$this->markingStore = $markingStore ?: new MultipleStateMarkingStore();
46-
$this->dispatcher = null !== $dispatcher ? LegacyEventDispatcherProxy::decorate($dispatcher) : null;
46+
47+
if (null !== $dispatcher && class_exists(LegacyEventDispatcherProxy::class)) {
48+
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
49+
} else {
50+
$this->dispatcher = $dispatcher;
51+
}
52+
4753
$this->name = $name;
4854
}
4955

0 commit comments

Comments
 (0)