Skip to content

Commit 72d8f3a

Browse files
committed
[Workflow] Fixed case when the marking store is not defined
1 parent c5eedac commit 72d8f3a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -810,9 +810,7 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
810810
// Create Workflow
811811
$workflowDefinition = new ChildDefinition(sprintf('%s.abstract', $type));
812812
$workflowDefinition->replaceArgument(0, new Reference(sprintf('%s.definition', $workflowId)));
813-
if (isset($markingStoreDefinition)) {
814-
$workflowDefinition->replaceArgument(1, $markingStoreDefinition);
815-
}
813+
$workflowDefinition->replaceArgument(1, $markingStoreDefinition ?? null);
816814
$workflowDefinition->replaceArgument(3, $name);
817815
$workflowDefinition->replaceArgument(4, $workflow['events_to_dispatch']);
818816

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,13 @@ public function testWorkflows()
226226

227227
$this->assertTrue($container->hasDefinition('workflow.article'), 'Workflow is registered as a service');
228228
$this->assertSame('workflow.abstract', $container->getDefinition('workflow.article')->getParent());
229-
$this->assertNull($container->getDefinition('workflow.article')->getArgument('index_4'), 'Workflows has eventsToDispatch=null');
229+
230+
$args = $container->getDefinition('workflow.article')->getArguments();
231+
$this->assertArrayHasKey('index_0', $args);
232+
$this->assertArrayHasKey('index_1', $args);
233+
$this->assertArrayHasKey('index_3', $args);
234+
$this->assertArrayHasKey('index_4', $args);
235+
$this->assertNull($args['index_4'], 'Workflows has eventsToDispatch=null');
230236

231237
$this->assertTrue($container->hasDefinition('workflow.article.definition'), 'Workflow definition is registered as a service');
232238

0 commit comments

Comments
 (0)