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

Commit87839cf

Browse files
committed
[Workflow] Finished integration of initial_marking + deprecated support for workflow + single state markin store
1 parent73708a6 commit87839cf

13 files changed

+43
-186
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,15 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
282282
->fixXmlConfig('argument')
283283
->children()
284284
->enumNode('type')
285-
->setDeprecated('The "%path%.%node%" configuration key has been deprecated in Symfony 4.3. Use "method" instead as it will be the only option in Symfony 5.0.')
286285
->values(['multiple_state','single_state','method'])
286+
->validate()
287+
->ifTrue(function ($v) {return'method' !==$v; })
288+
->then(function ($v) {
289+
@trigger_error('Passing something else than "method" has been deprecated in Symfony 4.3.',E_USER_DEPRECATED);
290+
291+
return$v;
292+
})
293+
->end()
287294
->end()
288295
->arrayNode('arguments')
289296
->setDeprecated('The "%path%.%node%" configuration key has been deprecated in Symfony 4.3. Use "property" instead.')
@@ -296,7 +303,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
296303
->end()
297304
->end()
298305
->scalarNode('property')
299-
->defaultNull()
306+
->defaultValue('marking')
300307
->end()
301308
->scalarNode('service')
302309
->cannotBeEmpty()
@@ -310,10 +317,6 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
310317
->ifTrue(function ($v) {return !empty($v['arguments']) &&isset($v['service']); })
311318
->thenInvalid('"arguments" and "service" cannot be used together.')
312319
->end()
313-
->validate()
314-
->ifTrue(function ($v) {return !empty($v['property']) &&isset($v['service']); })
315-
->thenInvalid('"property" and "service" cannot be used together.')
316-
->end()
317320
->end()
318321
->arrayNode('supports')
319322
->beforeNormalization()

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -644,14 +644,15 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
644644
// Create MarkingStore
645645
if (isset($workflow['marking_store']['type'])) {
646646
$markingStoreDefinition =newChildDefinition('workflow.marking_store.'.$workflow['marking_store']['type']);
647-
foreach ($workflow['marking_store']['arguments']as$argument) {
648-
$markingStoreDefinition->addArgument($argument);
649-
}
650647
if ('method' ===$workflow['marking_store']['type']) {
651648
$markingStoreDefinition->setArguments([
652649
'state_machine' ===$type,//single state
653-
$workflow['marking_store']['property'] ??'marking',
650+
$workflow['marking_store']['property'],
654651
]);
652+
}else {
653+
foreach ($workflow['marking_store']['arguments']as$argument) {
654+
$markingStoreDefinition->addArgument($argument);
655+
}
655656
}
656657
}elseif (isset($workflow['marking_store']['service'])) {
657658
$markingStoreDefinition =newReference($workflow['marking_store']['service']);
@@ -676,17 +677,14 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
676677
case'state_machine' ===$workflow['type']:
677678
$validator =newWorkflow\Validator\StateMachineValidator();
678679
break;
679-
case'method' === ($workflow['marking_store']['type'] ??null):
680-
$singlePlace =$workflow['marking_store']['arguments'][0] ??false;
681-
$validator =newWorkflow\Validator\WorkflowValidator($singlePlace);
682-
break;
683680
case'single_state' === ($workflow['marking_store']['type'] ??null):
684681
$validator =newWorkflow\Validator\WorkflowValidator(true);
685682
break;
686683
case'multiple_state' === ($workflow['marking_store']['type'] ??false):
687684
$validator =newWorkflow\Validator\WorkflowValidator(false);
688685
break;
689686
}
687+
690688
if ($validator) {
691689
$realDefinition = (newWorkflow\DefinitionBuilder($places))
692690
->addTransitions(array_map(function (Reference$ref)use ($container):Workflow\Transition {

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow-legacy.php‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
$container->loadFromExtension('framework', [
44
'workflows' => [
55
'legacy' => [
6-
'type' =>'workflow',
6+
'type' =>'state_machine',
7+
'marking_store' => [
8+
'type' =>'single_state',
9+
'arguments' => [
10+
'state',
11+
],
12+
],
713
'supports' => [
814
stdClass::class,
915
],

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow_with_property_and_service.php‎

Lines changed: 0 additions & 32 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflow-legacy.xml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
88

99
<framework:config>
10-
<framework:workflowname="legacy"type="workflow"initial-place="draft">
10+
<framework:workflowname="legacy"type="state_machine"initial-place="draft">
11+
<framework:marking-storetype="single_state">
12+
<framework:argument>state</framework:argument>
13+
</framework:marking-store>
1114
<framework:support>stdClass</framework:support>
1215
<framework:placename="draft" />
1316
<framework:placename="published" />

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflow_with_guard_expression.xml‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
<framework:config>
1010
<framework:workflowname="article"type="workflow">
1111
<framework:initial-marking>draft</framework:initial-marking>
12-
<framework:marking-store>
13-
<framework:argument>a</framework:argument>
14-
<framework:argument>a</framework:argument>
15-
</framework:marking-store>
1612
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
1713
<framework:place>draft</framework:place>
1814
<framework:place>wait_for_journalist</framework:place>

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflow_with_multiple_transitions_with_same_name.xml‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
<framework:config>
1010
<framework:workflowname="article"type="workflow">
1111
<framework:initial-marking>draft</framework:initial-marking>
12-
<framework:marking-storetype="multiple_state">
13-
<framework:argument>a</framework:argument>
14-
<framework:argument>a</framework:argument>
15-
</framework:marking-store>
1612
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
1713
<framework:placename="draft" />
1814
<framework:placename="wait_for_journalist" />

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflow_with_property_and_service.xml‎

Lines changed: 0 additions & 21 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflows.xml‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
<framework:config>
1010
<framework:workflowname="article"type="workflow">
1111
<framework:initial-marking>draft</framework:initial-marking>
12-
<framework:marking-storetype="multiple_state">
13-
<framework:argument>a</framework:argument>
14-
<framework:argument>a</framework:argument>
15-
</framework:marking-store>
12+
<framework:marking-storetype="method"property="state" />
1613
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
1714
<framework:placename="draft" />
1815
<framework:placename="wait_for_journalist" />

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/workflow-legacy.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
framework:
22
workflows:
33
legacy:
4-
type:workflow
4+
type:state_machine
5+
marking_store:
6+
type:single_state
7+
arguments:
8+
-state
59
initial_place:draft
610
supports:
711
-stdClass

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp