8000 feature #37979 [Workflow] Expose the Metadata Store in the DIC (lyrixx) · symfony/symfony@ba48f00 · GitHub
[go: up one dir, main page]

Skip to content

Commit ba48f00

Browse files
committed
feature #37979 [Workflow] Expose the Metadata Store in the DIC (lyrixx)
This PR was merged into the 5.2-dev branch. Discussion ---------- [Workflow] Expose the Metadata Store in the DIC | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fix #37955 | License | MIT | Doc PR | I did not updated the CHANGELOG, because IMHO it not worth it Commits ------- aa7a444 [Workflow] Expose the Metadata Store in the DIC
2 parents 4affb46 + aa7a444 commit ba48f00

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,7 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
742742
}
743743
}
744744
$metadataStoreDefinition->replaceArgument(2, $transitionsMetadataDefinition);
745+
$container->setDefinition(sprintf('%s.metadata_store', $workflowId), $metadataStoreDefinition);
745746

746747
// Create places
747748
$places = array_column($workflow['places'], 'name');
@@ -753,7 +754,7 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
753754
$definitionDefinition->addArgument($places);
754755
$definitionDefinition->addArgument($transitions);
755756
$definitionDefinition->addArgument($initialMarking);
756-
$definitionDefinition->addArgument($metadataStoreDefinition);
757+
$definitionDefinition->addArgument(new Reference(sprintf('%s.metadata_store', $workflowId)));
757758
$definitionDefinition->addTag('workflow.definition', [
758759
'name' => $name,
759760
'type' => $type,

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,11 @@ public function testWorkflows()
265265
$this->assertCount(9, $stateMachineDefinition->getArgument(1));
266266
$this->assertSame(['start'], $stateMachineDefinition->getArgument(2));
267267

268-
$metadataStoreDefinition = $stateMachineDefinition->getArgument(3);
269-
$this->assertInstanceOf(Definition::class, $metadataStoreDefinition);
268+
$metadataStoreReference = $stateMachineDefinition->getArgument(3);
269+
$this->assertInstanceOf(Reference::class, $metadataStoreReference);
270+
$this->assertSame('state_machine.pull_request.metadata_store', (string) $metadataStoreReference);
271+
272+
$metadataStoreDefinition = $container->getDefinition('state_machine.pull_request.metadata_store');
270273
$this->assertSame(Workflow\Metadata\InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
271274

272275
$workflowMetadata = $metadataStoreDefinition->getArgument(0);

0 commit comments

Comments
 (0)
0