Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[FrameworkBundle] Simplify marking store configuration #51148

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 1 commit into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode): void
->values(['method'])
->end()
->scalarNode('property')
->defaultValue('marking')
->cannotBeEmpty()
->end()
->scalarNode('service')
->cannotBeEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -998,11 +998,11 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $

// Create MarkingStore
$markingStoreDefinition = null;
if (isset($workflow['marking_store']['type'])) {
if (isset($workflow['marking_store']['type']) || isset($workflow['marking_store']['property'])) {
$markingStoreDefinition = new ChildDefinition('workflow.marking_store.method');
$markingStoreDefinition->setArguments([
'state_machine' === $type, // single state
$workflow['marking_store']['property'],
$workflow['marking_store']['property'] ?? 'marking',
]);
} elseif (isset($workflow['marking_store']['service'])) {
$markingStoreDefinition = new Reference($workflow['marking_store']['service']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
'my_workflow' => [
'type' => 'state_machine',
'marking_store' => [
'type' => 'method',
'property' => 'state',
],
'supports' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<framework:annotations enabled="false" />
<framework:workflow name="my_workflow" type="state_machine">
<framework:initial-marking>one</framework:initial-marking>
<framework:marking-store type="method" property="state" />
<framework:marking-store property="state" />
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase</framework:support>
<framework:event-to-dispatch>workflow.leave</framework:event-to-dispatch>
<framework:event-to-dispatch>workflow.completed</framework:event-to-dispatch>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ framework:
initial_marking: one
events_to_dispatch: ['workflow.leave', 'workflow.completed']
marking_store:
type: method
property: state
supports:
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase
Expand Down