Skip to content

Commit a88ddb4

Browse files
committed
minor #37226 [Lock] Move configuration to PHP (Tomas Javaisis)
This PR was squashed before being merged into the 5.2-dev branch. Discussion ---------- [Lock] Move configuration to PHP | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes-ish | Deprecations? | no | Tickets | #37186 | License | MIT | Doc PR | n/a Change lock config file from XML to PHP. Commits ------- 7882cd5527 [Lock] Move configuration to PHP
2 parents 0d42616 + 809e157 commit a88ddb4

File tree

3 files changed

+33
-29
lines changed

3 files changed

+33
-29
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ public function load(array $configs, ContainerBuilder $container)
390390
}
391391

392392
if ($this->isConfigEnabled($container, $config['lock'])) {
393-
$this->registerLockConfiguration($config['lock'], $container, $loader);
393+
$this->registerLockConfiguration($config['lock'], $container, $phpLoader);
394394
}
395395

396396
if ($this->isConfigEnabled($container, $config['web_link'])) {
@@ -1568,9 +1568,9 @@ private function registerPropertyInfoConfiguration(ContainerBuilder $container,
15681568
}
15691569
}
15701570

1571-
private function registerLockConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
1571+
private function registerLockConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader)
15721572
{
1573-
$loader->load('lock.xml');
1573+
$loader->load('lock.php');
15741574

15751575
foreach ($config['resources'] as $resourceName => $resourceStores) {
15761576
if (0 === \count($resourceStores)) {

Resources/config/lock.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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\Lock\LockFactory;
15+
use Symfony\Component\Lock\Store\CombinedStore;
16+
use Symfony\Component\Lock\Strategy\ConsensusStrategy;
17+
18+
return static function (ContainerConfigurator $container) {
19+
$container->services()
20+
->set('lock.store.combined.abstract', CombinedStore::class)->abstract()
21+
->args([abstract_arg('List of stores'), service('lock.strategy.majority')])
22+
23+
->set('lock.strategy.majority', ConsensusStrategy::class)
24+
25+
->set('lock.factory.abstract', LockFactory::class)->abstract()
26+
->args([abstract_arg('Store')])
27+
->call('setLogger', [service('logger')->ignoreOnInvalid()])
28+
->tag('monolog.logger', ['channel' => 'lock'])
29+
;
30+
};

Resources/config/lock.xml

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

0 commit comments

Comments
 (0)