Skip to content

Commit 4cd6d27

Browse files
committed
Convert configs to native PHP, full Symfony 8 compatibility
1 parent b654dfb commit 4cd6d27

4 files changed

Lines changed: 78 additions & 71 deletions

File tree

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
"ext-pdo_sqlite": "*",
3737
"ext-zip": "*",
3838
"doctrine/common": "^3.5.0",
39-
"doctrine/doctrine-bundle": "^2.18.1|^3.0.0",
40-
"doctrine/orm": "^2.19.3|^3.5.7",
39+
"doctrine/doctrine-bundle": "^2.18.1|^3.0.0@dev",
40+
"doctrine/orm": "^2.19.3|^3.5.7@dev",
4141
"doctrine/persistence": "^3.4.0|^4.1.1",
4242
"friendsofphp/php-cs-fixer": "^3.90.0",
4343
"mongodb/mongodb": "^1.20.0|^2.1.2",
@@ -48,7 +48,7 @@
4848
"phpstan/phpstan-doctrine": "^2.0.11",
4949
"phpstan/phpstan-phpunit": "^2.0.8",
5050
"phpstan/phpstan-symfony": "^2.0.8",
51-
"phpunit/phpunit": "^10.5.38|^11.5.44",
51+
"phpunit/phpunit": "^11.5.44|^12.4.4",
5252
"ruflin/elastica": "^7.3.2",
5353
"symfony/browser-kit": "^6.4.13|^7.3|^8.0",
5454
"symfony/css-selector": "^6.4.13|^7.3|^8.0",
@@ -59,11 +59,11 @@
5959
"symfony/phpunit-bridge": "^7.3|^8.0",
6060
"symfony/twig-bundle": "^6.4|^7.3|^8.0",
6161
"symfony/var-dumper": "^6.4.13|^7.3|^8.0",
62+
"symfony/var-exporter": "^v6.4.26|^7.3",
6263
"symfony/yaml": "^6.4.13|^7.3|^8.0"
6364
},
6465
"conflict": {
65-
"doctrine/orm": "^3.0 <3.3",
66-
"symfony/dependency-injection": ">=8.0"
66+
"doctrine/orm": "^3.0 <3.3"
6767
},
6868
"suggest": {
6969
"doctrine/doctrine-bundle": "For integrated access to Doctrine object managers",

src/DependencyInjection/DataTablesExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public function load(array $configs, ContainerBuilder $container): void
3434
$configuration = new Configuration();
3535
$config = $this->processConfiguration($configuration, $configs);
3636

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

4040
$container->setAlias('datatables.renderer', $config['renderer']);
4141
unset($config['renderer']);

src/Resources/config/services.php

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
3+
/*
4+
* Symfony DataTables Bundle
5+
* (c) Omines Internetbureau B.V. - https://omines.nl/
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
declare(strict_types=1);
12+
13+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
14+
15+
return static function (ContainerConfigurator $container) {
16+
$services = $container->services();
17+
$parameters = $container->parameters();
18+
19+
$services->defaults()
20+
->private()
21+
->autowire()
22+
->autoconfigure();
23+
24+
$services->set(\Omines\DataTablesBundle\Adapter\ArrayAdapter::class);
25+
26+
$services->set(\Omines\DataTablesBundle\Adapter\Doctrine\ORMAdapter::class)
27+
->args([service('doctrine')->nullOnInvalid()]);
28+
29+
$services->set(\Omines\DataTablesBundle\Adapter\Doctrine\FetchJoinORMAdapter::class)
30+
->args([service('doctrine')->nullOnInvalid()]);
31+
32+
$services->set(\Omines\DataTablesBundle\Column\TwigColumn::class)
33+
->args([service('twig')->nullOnInvalid()]);
34+
35+
$services->set(\Omines\DataTablesBundle\Column\TwigStringColumn::class)
36+
->args([service('twig')->nullOnInvalid()]);
37+
38+
$services->set(\Omines\DataTablesBundle\Exporter\DataTableExporterCollection::class)
39+
->args([tagged_iterator('datatables.exporter')]);
40+
41+
$services->set(\Omines\DataTablesBundle\Exporter\DataTableExporterManager::class)
42+
->args([
43+
service(\Omines\DataTablesBundle\Exporter\DataTableExporterCollection::class),
44+
service('translator'),
45+
]);
46+
47+
$services->set(\Omines\DataTablesBundle\Exporter\Excel\ExcelExporter::class)
48+
->tag('datatables.exporter');
49+
50+
$services->set(\Omines\DataTablesBundle\Exporter\Excel\ExcelOpenSpoutExporter::class)
51+
->tag('datatables.exporter');
52+
53+
$services->set(\Omines\DataTablesBundle\Exporter\Csv\CsvExporter::class)
54+
->tag('datatables.exporter');
55+
56+
$services->set(\Omines\DataTablesBundle\DataTableFactory::class)
57+
->public()
58+
->args([
59+
'%datatables.config%',
60+
service('datatables.renderer'),
61+
service(\Omines\DataTablesBundle\DependencyInjection\Instantiator::class),
62+
service('event_dispatcher'),
63+
]);
64+
65+
$services->set(\Omines\DataTablesBundle\DependencyInjection\Instantiator::class);
66+
67+
$services->set(\Omines\DataTablesBundle\Twig\DataTablesExtension::class);
68+
69+
$services->set(\Omines\DataTablesBundle\Twig\TwigRenderer::class)
70+
->args([service('twig')->nullOnInvalid()]);
71+
};

src/Resources/config/services.xml

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

0 commit comments

Comments
 (0)