Skip to content

Commit 54d786c

Browse files
committed
[FrameworkBundle] changed configuration file for workflow from XML to PHP
1 parent 6d0302b commit 54d786c

File tree

3 files changed

+49
-33
lines changed

3 files changed

+49
-33
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ public function load(array $configs, ContainerBuilder $container)
372372
$this->registerFragmentsConfiguration($config['fragments'], $container, $phpLoader);
373373
$this->registerTranslatorConfiguration($config['translator'], $container, $phpLoader, $config['default_locale']);
374374
$this->registerProfilerConfiguration($config['profiler'], $container, $loader, $phpLoader);
375-
$this->registerWorkflowConfiguration($config['workflows'], $container, $loader);
375+
$this->registerWorkflowConfiguration($config['workflows'], $container, $phpLoader);
376376
$this->registerDebugConfiguration($config['php_errors'], $container, $phpLoader);
377377
$this->registerRouterConfiguration($config['router'], $container, $phpLoader, $config['translator']['enabled_locales'] ?? []);
378378
$this->registerAnnotationsConfiguration($config['annotations'], $container, $phpLoader);
@@ -639,7 +639,7 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $
639639
->addTag('kernel.reset', ['method' => 'reset']);
640640
}
641641

642-
private function registerWorkflowConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
642+
private function registerWorkflowConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader)
643643
{
644644
if (!$config['enabled']) {
645645
$container->removeDefinition('console.command.workflow_dump');
@@ -651,7 +651,7 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
651651
throw new LogicException('Workflow support cannot be enabled as the Workflow component is not installed. Try running "composer require symfony/workflow".');
652652
}
653653

654-
$loader->load('workflow.xml');
654+
$loader->load('workflow.php');
655655

656656
$registryDefinition = $container->getDefinition('workflow.registry');
657657

Resources/config/workflow.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
13+
14+
use Symfony\Component\Workflow\EventListener\ExpressionLanguage;
15+
use Symfony\Component\Workflow\MarkingStore\MethodMarkingStore;
16+
use Symfony\Component\Workflow\Registry;
17+
use Symfony\Component\Workflow\StateMachine;
18+
use Symfony\Component\Workflow\Workflow;
19+
20+
return static function (ContainerConfigurator $container) {
21+
$container->services()
22+
->set('workflow.abstract', Workflow::class)
23+
->args([
24+
abstract_arg('workflow definition'),
25+
abstract_arg('marking store'),
26+
service('event_dispatcher')->ignoreOnInvalid(),
27+
abstract_arg('workflow name'),
28+
])
29+
->abstract()
30+
->public()
31+
->set('state_machine.abstract', StateMachine::class)
32+
->args([
33+
abstract_arg('workflow definition'),
34+
abstract_arg('marking store'),
35+
service('event_dispatcher')->ignoreOnInvalid(),
36+
abstract_arg('workflow name'),
37+
])
38+
->abstract()
39+
->public()
40+
->set('workflow.marking_store.method', MethodMarkingStore::class)
41+
->abstract()
42+
->set('workflow.registry', Registry::class)
43+
->alias(Registry::class, 'workflow.registry')
44+
->set('workflow.security.expression_language', ExpressionLanguage::class)
45+
;
46+
};

Resources/config/workflow.xml

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)