From 6737e461391ae8afda26a578cc67f3e6fc093f19 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 28 Jul 2023 15:31:57 +0200 Subject: [PATCH] [FrameworkBundle] Simplify marking store configuration --- .../FrameworkBundle/DependencyInjection/Configuration.php | 2 +- .../DependencyInjection/FrameworkExtension.php | 4 ++-- .../php/workflow_with_specified_events_to_dispatch.php | 1 - .../xml/workflow_with_specified_events_to_dispatch.xml | 2 +- .../yml/workflow_with_specified_events_to_dispatch.yml | 1 - 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 6782868805897..613526d4fb29a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -406,7 +406,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode): void ->values(['method']) ->end() ->scalarNode('property') - ->defaultValue('marking') + ->cannotBeEmpty() ->end() ->scalarNode('service') ->cannotBeEmpty() diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 56242bf318de7..b17e0f9c98804 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -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']); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow_with_specified_events_to_dispatch.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow_with_specified_events_to_dispatch.php index afaa4d3c2f65f..46b7263cf8b54 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow_with_specified_events_to_dispatch.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflow_with_specified_events_to_dispatch.php @@ -9,7 +9,6 @@ 'my_workflow' => [ 'type' => 'state_machine', 'marking_store' => [ - 'type' => 'method', 'property' => 'state', ], 'supports' => [ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflow_with_specified_events_to_dispatch.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflow_with_specified_events_to_dispatch.xml index a0d4c9dd6c8a1..8c62c6b73ed76 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflow_with_specified_events_to_dispatch.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflow_with_specified_events_to_dispatch.xml @@ -10,7 +10,7 @@ one - + Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTestCase workflow.leave workflow.completed diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/workflow_with_specified_events_to_dispatch.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/workflow_with_specified_events_to_dispatch.yml index d0b62034ddd0e..f26bd26382551 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/workflow_with_specified_events_to_dispatch.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/workflow_with_specified_events_to_dispatch.yml @@ -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 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy