Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit62d272c

Browse files
committed
feature#51227 [FrameworkBundle][Workflow] Attach the workflow's configuration to theworkflow tag (lyrixx)
This PR was merged into the 7.1 branch.Discussion----------[FrameworkBundle][Workflow] Attach the workflow's configuration to the `workflow` tag| Q | A| ------------- | ---| Branch? | 7.1| Bug fix? | no| New feature? | yes| Deprecations? | no| Tickets || License | MIT| Doc PR |Since the registry is deprecated, users have to build there own registry when a service locator is not enough.However, some information can be missing, like the `supports` configuration option.In this PR, I add the whole configuration to the tag, so everyone can build exactly what they need.The config is added only to the `workflow` tag, not sub tags. To get it:```phpclass Kernel extends BaseKernel implements CompilerPassInterface{ use MicroKernelTrait; public function process(ContainerBuilder $container) { foreach ($container->findTaggedServiceIds('workflow.workflow') as $id => $attributes) { $config = $container->getDefinition($id)->getTag('workflow')[0]; dd($config); } }}```Commits-------887a3c0 [FrameworkBundle][Workflow] Attach the workflow's configuration to the `workflow` tag
2 parentsd7b9240 +887a3c0 commit62d272c

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

‎src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CHANGELOG
1212
* Add`rate_limiter` tags to rate limiter services
1313
* Add`secrets:reveal` command
1414
* Add`rate_limiter` option to`http_client.default_options` and`http_client.scoped_clients`
15+
* Attach the workflow's configuration to the`workflow` tag
1516

1617
7.0
1718
---

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
10291029
$workflowDefinition->replaceArgument(3,$name);
10301030
$workflowDefinition->replaceArgument(4,$workflow['events_to_dispatch']);
10311031

1032-
$workflowDefinition->addTag('workflow', ['name' =>$name]);
1032+
$workflowDefinition->addTag('workflow', ['name' =>$name,'metadata' =>$workflow['metadata']]);
10331033
if ('workflow' ===$type) {
10341034
$workflowDefinition->addTag('workflow.workflow', ['name' =>$name]);
10351035
}elseif ('state_machine' ===$type) {

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php‎

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484
useSymfony\Component\Validator\Validator\ValidatorInterface;
8585
useSymfony\Component\Webhook\Client\RequestParser;
8686
useSymfony\Component\Webhook\Controller\WebhookController;
87-
useSymfony\Component\Workflow;
8887
useSymfony\Component\Workflow\Exception\InvalidDefinitionException;
8988
useSymfony\Component\Workflow\Metadata\InMemoryMetadataStore;
9089
useSymfony\Component\Workflow\WorkflowEvents;
@@ -302,7 +301,15 @@ public function testWorkflows()
302301
$this->assertArrayHasKey('index_4',$args);
303302
$this->assertNull($args['index_4'],'Workflows has eventsToDispatch=null');
304303

305-
$this->assertSame(['workflow' => [['name' =>'article']],'workflow.workflow' => [['name' =>'article']]],$container->getDefinition('workflow.article')->getTags());
304+
$tags =$container->getDefinition('workflow.article')->getTags();
305+
$this->assertArrayHasKey('workflow',$tags);
306+
$this->assertArrayHasKey('workflow.workflow',$tags);
307+
$this->assertSame([['name' =>'article']],$tags['workflow.workflow']);
308+
$this->assertSame('article',$tags['workflow'][0]['name'] ??null);
309+
$this->assertSame([
310+
'title' =>'article workflow',
311+
'description' =>'workflow for articles',
312+
],$tags['workflow'][0]['metadata'] ??null);
306313

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

@@ -333,7 +340,14 @@ public function testWorkflows()
333340
$this->assertSame('state_machine.abstract',$container->getDefinition('state_machine.pull_request')->getParent());
334341
$this->assertTrue($container->hasDefinition('state_machine.pull_request.definition'),'State machine definition is registered as a service');
335342

336-
$this->assertSame(['workflow' => [['name' =>'pull_request']],'workflow.state_machine' => [['name' =>'pull_request']]],$container->getDefinition('state_machine.pull_request')->getTags());
343+
$tags =$container->getDefinition('state_machine.pull_request')->getTags();
344+
$this->assertArrayHasKey('workflow',$tags);
345+
$this->assertArrayHasKey('workflow.state_machine',$tags);
346+
$this->assertSame([['name' =>'pull_request']],$tags['workflow.state_machine']);
347+
$this->assertSame('pull_request',$tags['workflow'][0]['name'] ??null);
348+
$this->assertSame([
349+
'title' =>'workflow title',
350+
],$tags['workflow'][0]['metadata'] ??null);
337351

338352
$stateMachineDefinition =$container->getDefinition('state_machine.pull_request.definition');
339353

@@ -357,7 +371,7 @@ public function testWorkflows()
357371
$this->assertSame('state_machine.pull_request.metadata_store', (string)$metadataStoreReference);
358372

359373
$metadataStoreDefinition =$container->getDefinition('state_machine.pull_request.metadata_store');
360-
$this->assertSame(Workflow\Metadata\InMemoryMetadataStore::class,$metadataStoreDefinition->getClass());
374+
$this->assertSame(InMemoryMetadataStore::class,$metadataStoreDefinition->getClass());
361375
$this->assertSame(InMemoryMetadataStore::class,$metadataStoreDefinition->getClass());
362376

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp