Skip to content

Commit c3d383b

Browse files
committed
[PropertyAccess] Move configuration to PHP
1 parent 76a757f commit c3d383b

File tree

3 files changed

+34
-23
lines changed

3 files changed

+34
-23
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ public function load(array $configs, ContainerBuilder $container)
374374
$this->registerDebugConfiguration($config['php_errors'], $container, $loader);
375375
$this->registerRouterConfiguration($config['router'], $container, $loader, $config['translator']['enabled_locales'] ?? []);
376376
$this->registerAnnotationsConfiguration($config['annotations'], $container, $loader);
377-
$this->registerPropertyAccessConfiguration($config['property_access'], $container, $loader);
377+
$this->registerPropertyAccessConfiguration($config['property_access'], $container, $phpLoader);
378378
$this->registerSecretsConfiguration($config['secrets'], $container, $phpLoader);
379379

380380
if ($this->isConfigEnabled($container, $config['serializer'])) {
@@ -1381,13 +1381,13 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
13811381
}
13821382
}
13831383

1384-
private function registerPropertyAccessConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
1384+
private function registerPropertyAccessConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader)
13851385
{
13861386
if (!class_exists(PropertyAccessor::class)) {
13871387
return;
13881388
}
13891389

1390-
$loader->load('property_access.xml');
1390+
$loader->load('property_access.php');
13911391

13921392
$container
13931393
->getDefinition('property_accessor')

Resources/config/property_access.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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\PropertyAccess\PropertyAccessor;
15+
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
16+
17+
return static function (ContainerConfigurator $container) {
18+
$container->services()
19+
->set('property_accessor', PropertyAccessor::class)
20+
->args([
21+
abstract_arg('magicCall, set by the extension'),
22+
abstract_arg('throwExceptionOnInvalidIndex, set by the extension'),
23+
service('cache.property_access')->ignoreOnInvalid(),
24+
abstract_arg('throwExceptionOnInvalidPropertyPath, set by the extension'),
25+
abstract_arg('propertyReadInfoExtractor'),
26+
abstract_arg('propertyWriteInfoExtractor'),
27+
])
28+
29+
->alias(PropertyAccessorInterface::class, 'property_accessor')
30+
;
31+
};

Resources/config/property_access.xml

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

0 commit comments

Comments
 (0)