Skip to content

Commit

Permalink
Merge 2.x into 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI committed Dec 21, 2021
2 parents 2c330fa + fda8da4 commit 9d1c75b
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
name: Documentation

on:
schedule:
- cron: '30 0 * * *'
push:
branches:
- 2.x
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
name: Lint

on:
schedule:
- cron: '30 0 * * *'
push:
branches:
- 2.x
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
name: Quality assurance

on:
schedule:
- cron: '30 0 * * *'
push:
branches:
- 2.x
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
name: Test

on:
schedule:
- cron: '30 0 * * *'
push:
branches:
- 2.x
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,5 @@ phpstan:
.PHONY: phpstan

psalm:
vendor/bin/psalm
vendor/bin/psalm --php-version=8.1
.PHONY: psalm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
Expand All @@ -30,8 +30,8 @@ public function load(array $configs, ContainerBuilder $container): void
$configuration = new Configuration();
$config = $processor->processConfiguration($configuration, $configs);

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

$this->configureExporter($container, $config['exporter']);
$this->configureWriters($container, $config['writers']);
Expand Down
57 changes: 57 additions & 0 deletions src/Bridge/Symfony/Resources/config/services.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use Sonata\Exporter\Exporter;
use Sonata\Exporter\Writer\CsvWriter;
use Sonata\Exporter\Writer\JsonWriter;
use Sonata\Exporter\Writer\XlsWriter;
use Sonata\Exporter\Writer\XmlWriter;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
// Use "param" function for creating references to parameters when dropping support for Symfony 5.1
$services = $containerConfigurator->services();

$services->set('sonata.exporter.writer.csv', CsvWriter::class)
->args([
'%sonata.exporter.writer.csv.filename%',
'%sonata.exporter.writer.csv.delimiter%',
'%sonata.exporter.writer.csv.enclosure%',
'%sonata.exporter.writer.csv.escape%',
'%sonata.exporter.writer.csv.show_headers%',
'%sonata.exporter.writer.csv.with_bom%',
]);

$services->set('sonata.exporter.writer.json', JsonWriter::class)
->args([
'%sonata.exporter.writer.json.filename%',
]);

$services->set('sonata.exporter.writer.xls', XlsWriter::class)
->args([
'%sonata.exporter.writer.xls.filename%',
'%sonata.exporter.writer.xls.show_headers%',
]);

$services->set('sonata.exporter.writer.xml', XmlWriter::class)
->args([
'%sonata.exporter.writer.xml.filename%',
'%sonata.exporter.writer.xml.main_element%',
'%sonata.exporter.writer.xml.child_element%',
]);

$services->set('sonata.exporter.exporter', Exporter::class)
->public();

$services->alias(Exporter::class, 'sonata.exporter.exporter');
};
27 changes: 0 additions & 27 deletions src/Bridge/Symfony/Resources/config/services.xml

This file was deleted.

0 comments on commit 9d1c75b

Please sign in to comment.