Skip to content

Commit 593fc09

Browse files
committed
[Workflow] The type option of the framework.workflows.* configuration entries is state_machine
1 parent 9e3cf4a commit 593fc09

File tree

10 files changed

+10
-75
lines changed

10 files changed

+10
-75
lines changed

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ CHANGELOG
44
4.0.0
55
-----
66

7-
* Removed `ValidateWorkflowsPass`
7+
* Removed `ValidateWorkflowsPass`
8+
* The default `type` option of the `framework.workflows.*` configuration entries is `state_machine`
89

910
3.3.0
1011
-----

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
230230
->end()
231231
->enumNode('type')
232232
->values(array('workflow', 'state_machine'))
233+
->defaultValue('state_machine')
233234
->end()
234235
->arrayNode('marking_store')
235236
->fixXmlConfig('argument')

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,6 @@ private function registerWorkflowConfiguration(array $workflows, ContainerBuilde
498498
$registryDefinition = $container->getDefinition('workflow.registry');
499499

500500
foreach ($workflows as $name => $workflow) {
501-
if (!array_key_exists('type', $workflow)) {
502-
$workflow['type'] = 'workflow';
503-
@trigger_error(sprintf('The "type" option of the "framework.workflows.%s" configuration entry must be defined since Symfony 3.3. The default value will be "state_machine" in Symfony 4.0.', $name), E_USER_DEPRECATED);
504-
}
505501
$type = $workflow['type'];
506502

507503
$transitions = array();

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflows.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
),
4242
),
4343
'pull_request' => array(
44-
'type' => 'state_machine',
4544
'marking_store' => array(
4645
'type' => 'single_state',
4746
),

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflows_without_type.php

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
</framework:transition>
4040
</framework:workflow>
4141

42-
<framework:workflow name="pull_request" type="state_machine" initial-place="start">
42+
<framework:workflow name="pull_request" initial-place="start">
4343
<framework:marking-store type="single_state"/>
4444
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
4545
<framework:place>start</framework:place>

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflows_without_type.xml

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

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/workflows.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ framework:
2828
from: [approved_by_journalist, approved_by_spellchecker]
2929
to: [published]
3030
pull_request:
31-
type: state_machine
3231
marking_store:
3332
type: single_state
3433
supports:

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/workflows_without_type.yml

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

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

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@ public function testWorkflows()
154154
{
155155
$container = $this->createContainerFromFile('workflows');
156156

157-
$this->assertTrue($container->hasDefinition('workflow.article', 'Workflow is registered as a service'));
158-
$this->assertTrue($container->hasDefinition('workflow.article.definition', 'Workflow definition is registered as a service'));
157+
$this->assertTrue($container->hasDefinition('workflow.article'), 'Workflow is registered as a service');
158+
$this->assertSame('workflow.abstract', $container->getDefinition('workflow.article')->getParent());
159+
$this->assertTrue($container->hasDefinition('workflow.article.definition'), 'Workflow definition is registered as a service');
159160

160161
$workflowDefinition = $container->getDefinition('workflow.article.definition');
161162

@@ -173,8 +174,9 @@ public function testWorkflows()
173174
);
174175
$this->assertSame(array('workflow.definition' => array(array('name' => 'article', 'type' => 'workflow', 'marking_store' => 'multiple_state'))), $workflowDefinition->getTags());
175176

176-
$this->assertTrue($container->hasDefinition('state_machine.pull_request', 'State machine is registered as a service'));
177-
$this->assertTrue($container->hasDefinition('state_machine.pull_request.definition', 'State machine definition is registered as a service'));
177+
$this->assertTrue($container->hasDefinition('state_machine.pull_request'), 'State machine is registered as a service');
178+
$this->assertSame('state_machine.abstract', $container->getDefinition('state_machine.pull_request')->getParent());
179+
$this->assertTrue($container->hasDefinition('state_machine.pull_request.definition'), 'State machine definition is registered as a service');
178180
$this->assertCount(4, $workflowDefinition->getArgument(1));
179181
$this->assertSame('draft', $workflowDefinition->getArgument(2));
180182

@@ -207,15 +209,6 @@ public function testWorkflows()
207209
$this->assertGreaterThan(0, count($registryDefinition->getMethodCalls()));
208210
}
209211

210-
/**
211-
* @group legacy
212-
* @expectedDeprecation The "type" option of the "framework.workflows.missing_type" configuration entry must be defined since Symfony 3.3. The default value will be "state_machine" in Symfony 4.0.
213-
*/
214-
public function testDeprecatedWorkflowMissingType()
215-
{
216-
$container = $this->createContainerFromFile('workflows_without_type');
217-
}
218-
219212
/**
220213
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
221214
* @expectedExceptionMessage "type" and "service" cannot be used together.

0 commit comments

Comments
 (0)