[Workflow] Deprecate worflow and single state marking
This commit is contained in:
parent
87839cfaf9
commit
039353546f
@ -237,6 +237,29 @@ Workflow
|
||||
property: state
|
||||
```
|
||||
|
||||
* Using a workflow with a single state marking is deprecated. Use a state machine instead.
|
||||
|
||||
Before:
|
||||
```yaml
|
||||
framework:
|
||||
workflows:
|
||||
article:
|
||||
type: workflow
|
||||
marking_store:
|
||||
type: single_state
|
||||
```
|
||||
|
||||
After:
|
||||
```yaml
|
||||
framework:
|
||||
workflows:
|
||||
article:
|
||||
type: state_machine
|
||||
marking_store:
|
||||
# type: single_state # Since the single_state marking store is deprecated, use method instead
|
||||
type: method
|
||||
```
|
||||
|
||||
Yaml
|
||||
----
|
||||
|
||||
|
@ -430,6 +430,27 @@ Workflow
|
||||
property: state
|
||||
```
|
||||
|
||||
|
||||
* Support for using a workflow with a single state marking is dropped. Use a state machine instead.
|
||||
|
||||
Before:
|
||||
```yaml
|
||||
framework:
|
||||
workflows:
|
||||
article:
|
||||
type: workflow
|
||||
marking_store:
|
||||
type: single_state
|
||||
```
|
||||
|
||||
After:
|
||||
```yaml
|
||||
framework:
|
||||
workflows:
|
||||
article:
|
||||
type: state_machine
|
||||
```
|
||||
|
||||
Yaml
|
||||
----
|
||||
|
||||
|
@ -474,6 +474,16 @@ class Configuration implements ConfigurationInterface
|
||||
})
|
||||
->thenInvalid('"supports" or "support_strategy" should be configured.')
|
||||
->end()
|
||||
->validate()
|
||||
->ifTrue(function ($v) {
|
||||
return 'workflow' === $v['type'] && 'single_state' === ($v['marking_store']['type'] ?? false);
|
||||
})
|
||||
->then(function ($v) {
|
||||
@trigger_error('Using a workflow with type=workflow and a marking_store=single_state is deprecated since Symfony 4.3. Use type=state_machine instead.', E_USER_DEPRECATED);
|
||||
|
||||
return $v;
|
||||
})
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
|
@ -88,6 +88,40 @@ class PhpFrameworkExtensionTest extends FrameworkExtensionTest
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation Using a workflow with type=workflow and a marking_store=single_state is deprecated since Symfony 4.3. Use type=state_machine instead.
|
||||
*/
|
||||
public function testWorkflowDeprecateWorkflowSingleState()
|
||||
{
|
||||
$this->createContainerFromClosure(function ($container) {
|
||||
$container->loadFromExtension('framework', [
|
||||
'workflows' => [
|
||||
'article' => [
|
||||
'type' => 'workflow',
|
||||
'marking_store' => [
|
||||
'type' => 'single_state',
|
||||
],
|
||||
'supports' => [
|
||||
__CLASS__,
|
||||
],
|
||||
'places' => [
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
],
|
||||
'transitions' => [
|
||||
'a_to_b' => [
|
||||
'from' => ['a'],
|
||||
'to' => ['b'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
|
Reference in New Issue
Block a user