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

Appearance settings

Commit 619bcae

Browse filesBrowse files
committed
[FrameworkBundle][Workflow] Deprecate the default type of a workflow
Before this patch, the default type is "workflow". Most of the time a "state_machine" is better because it's simpler and it involves less knowledge to be able to use it. So this patch deprecate a missing type in Symfony 3.3. And In Symfony 4.0 the default value will become "state_machine".
1 parent 46fc0b9 commit 619bcae
Copy full SHA for 619bcae

File tree

8 files changed

+23
-11
lines changed
Filter options

8 files changed

+23
-11
lines changed

‎UPGRADE-3.3.md

Copy file name to clipboardExpand all lines: UPGRADE-3.3.md
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,14 @@ Form
138138
* Using the "choices" option in ``CountryType``, ``CurrencyType``, ``LanguageType``,
139139
``LocaleType``, and ``TimezoneType`` without overriding the ``choice_loader``
140140
option has been deprecated and will be ignored in 4.0.
141-
141+
142142
Before:
143143
```php
144144
$builder->add('custom_locales', LocaleType::class, array(
145145
'choices' => $availableLocales,
146146
));
147147
```
148-
148+
149149
After:
150150
```php
151151
$builder->add('custom_locales', LocaleType::class, array(
@@ -168,6 +168,9 @@ FrameworkBundle
168168

169169
* The "framework.trusted_proxies" configuration option and the corresponding "kernel.trusted_proxies" parameter have been deprecated and will be removed in 4.0. Use the Request::setTrustedProxies() method in your front controller instead.
170170

171+
* Not defining the "type" option of the "framework.workflows.*" configuration entry is deprecated.
172+
The default value will be "state_machine" in Symfony 4.0.
173+
171174
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CompilerDebugDumpPass` has been deprecated.
172175

173176
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleCommandPass` has been deprecated.

‎UPGRADE-4.0.md

Copy file name to clipboardExpand all lines: UPGRADE-4.0.md
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ Form
198198
* Using the "choices" option in ``CountryType``, ``CurrencyType``, ``LanguageType``,
199199
``LocaleType``, and ``TimezoneType`` without overriding the ``choice_loader``
200200
option is now ignored.
201-
201+
202202
Before:
203203
```php
204204
$builder->add('custom_locales', LocaleType::class, array(
205205
'choices' => $availableLocales,
206206
));
207207
```
208-
208+
209209
After:
210210
```php
211211
$builder->add('custom_locales', LocaleType::class, array(
@@ -228,6 +228,8 @@ FrameworkBundle
228228

229229
* The "framework.trusted_proxies" configuration option and the corresponding "kernel.trusted_proxies" parameter have been removed. Use the `Request::setTrustedProxies()` method in your front controller instead.
230230

231+
* The default value of the "framework.workflows.[name].type" configuration option is now "state_machine".
232+
231233
* Support for absolute template paths has been removed.
232234

233235
* The following form types registered as services have been removed; use their
@@ -411,7 +413,7 @@ Security
411413

412414
* The `RoleInterface` has been removed. Extend the `Symfony\Component\Security\Core\Role\Role`
413415
class instead.
414-
416+
415417
* The `LogoutUrlGenerator::registerListener()` method expects a 6th `$context = null` argument.
416418

417419
* The `AccessDecisionManager::setVoters()` method has been removed. Pass the

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ CHANGELOG
44
3.3.0
55
-----
66

7+
* Not defining the "type" option of the "framework.workflows.*" configuration entry is deprecated.
8+
The default value will be "state_machine" in Symfony 4.0.
79
* Deprecated the `CompilerDebugDumpPass` class
810
* [BC BREAK] Removed the "framework.trusted_proxies" configuration option and the corresponding "kernel.trusted_proxies" parameter
911
* Added a new new version strategy option called json_manifest_path
@@ -33,13 +35,13 @@ CHANGELOG
3335
* Deprecated `ControllerArgumentValueResolverPass`. Use
3436
`Symfony\Component\HttpKernel\DependencyInjection\ControllerArgumentValueResolverPass` instead
3537
* Deprecated `RoutingResolverPass`, use `Symfony\Component\Routing\DependencyInjection\RoutingResolverPass` instead
36-
* [BC BREAK] The `server:run`, `server:start`, `server:stop` and
37-
`server:status` console commands have been moved to a dedicated bundle.
38-
Require `symfony/web-server-bundle` in your composer.json and register
38+
* [BC BREAK] The `server:run`, `server:start`, `server:stop` and
39+
`server:status` console commands have been moved to a dedicated bundle.
40+
Require `symfony/web-server-bundle` in your composer.json and register
3941
`Symfony\Bundle\WebServerBundle\WebServerBundle` in your AppKernel to use them.
4042
* Added `$defaultLocale` as 3rd argument of `Translator::__construct()`
4143
making `Translator` works with any PSR-11 container
42-
* Added `framework.serializer.mapping` config option allowing to define custom
44+
* Added `framework.serializer.mapping` config option allowing to define custom
4345
serialization mapping files and directories
4446
* Deprecated `AddValidatorInitializersPass`, use
4547
`Symfony\Component\Validator\DependencyInjection\AddValidatorInitializersPass` instead

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
230230
->end()
231231
->enumNode('type')
232232
->values(array('workflow', 'state_machine'))
233-
->defaultValue('workflow')
234233
->end()
235234
->arrayNode('marking_store')
236235
->fixXmlConfig('argument')

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,10 @@ private function registerWorkflowConfiguration(array $workflows, ContainerBuilde
440440
$registryDefinition = $container->getDefinition('workflow.registry');
441441

442442
foreach ($workflows as $name => $workflow) {
443+
if (!array_key_exists('type', $workflow)) {
444+
$workflow['type'] = 'workflow';
445+
@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);
446+
}
443447
$type = $workflow['type'];
444448

445449
$transitions = array();

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflows.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
),
9090
),
9191
'service_marking_store_workflow' => array(
92+
'type' => 'workflow',
9293
'marking_store' => array(
9394
'service' => 'workflow_service',
9495
),

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflows.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</framework:transition>
8181
</framework:workflow>
8282

83-
<framework:workflow name="service_marking_store_workflow">
83+
<framework:workflow name="service_marking_store_workflow" type="workflow">
8484
<framework:marking-store service="workflow_service"/>
8585
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
8686
<framework:place>first</framework:place>

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/workflows.yml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ framework:
6464
from: closed
6565
to: review
6666
service_marking_store_workflow:
67+
type: workflow
6768
marking_store:
6869
service: workflow_service
6970
supports:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.