Skip to content
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
8 changes: 4 additions & 4 deletions src/DependencyInjection/NelmioSolariumExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Reference;

/**
Expand All @@ -35,12 +35,12 @@ public function load(array $configs, ContainerBuilder $container)
{
$config = $this->processConfiguration(new Configuration(), $configs);

$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('registry.xml');
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('registry.php');

$isDebug = true === $container->getParameter('kernel.debug');
if ($isDebug) {
$loader->load('logger.xml');
$loader->load('logger.php');
}

$defaultClient = $config['default_client'];
Expand Down
29 changes: 29 additions & 0 deletions src/Resources/config/logger.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

/**
* This file is part of the Nelmio SolariumBundle.
*
* (c) Nelmio <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Nelmio\SolariumBundle\Logger;

return static function (ContainerConfigurator $container) {
$container->parameters()
->set('solarium.data_collector.class', Logger::class);

$container->services()
->set('solarium.data_collector', '%solarium.data_collector.class%')
->public()
->tag('data_collector', ['template' => '@NelmioSolarium/DataCollector/solarium', 'id' => 'solr'])
->tag('monolog.logger', ['channel' => 'solr'])
->call('setLogger', [service('logger')->ignoreOnInvalid()])
->call('setStopWatch', [service('debug.stopwatch')->ignoreOnInvalid()]);
};
24 changes: 0 additions & 24 deletions src/Resources/config/logger.xml

This file was deleted.

29 changes: 29 additions & 0 deletions src/Resources/config/registry.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

/**
* This file is part of the Nelmio SolariumBundle.
*
* (c) Nelmio <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Nelmio\SolariumBundle\ClientRegistry;

return static function (ContainerConfigurator $container) {
$container->parameters()
->set('solarium.client_registry.class', ClientRegistry::class);

$container->services()
->set('solarium.client_registry', '%solarium.client_registry.class%')
->public()
->args([
[],
null,
]);
};
18 changes: 0 additions & 18 deletions src/Resources/config/registry.xml

This file was deleted.