8000 [Workflow] Changed initial_places to initial_marking, added property by lyrixx · Pull Request #30890 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Workflow] Changed initial_places to initial_marking, added property #30890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 6, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[Workflow] Deprecate worflow and single state marking
  • Loading branch information
lyrixx committed Apr 6, 2019
commit 039353546f570ca14ceecde1b21ace42ccbcc28b
23 changes: 23 additions & 0 deletions UPGRADE-4.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
----

Expand Down
21 changes: 21 additions & 0 deletions UPGRADE-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
----

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,16 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
})
->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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,40 @@ public function testWorkflowValidationStateMachine()
});
}

/**
* @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
*/
Expand Down
0