|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
//---------------------------------------------------------------------- |
|
4
|
|
|
// |
|
5
|
|
|
// Copyright (C) 2015-2022 Artem Rodygin |
|
6
|
|
|
// |
|
7
|
|
|
// This file is part of DataTables Symfony bundle. |
|
8
|
|
|
// |
|
9
|
|
|
// You should have received a copy of the MIT License along with |
|
10
|
|
|
// the bundle. If not, see <http://opensource.org/licenses/MIT>. |
|
11
|
|
|
// |
|
12
|
|
|
//---------------------------------------------------------------------- |
|
13
|
|
|
|
|
14
|
|
|
namespace DataTables\DependencyInjection; |
|
15
|
|
|
|
|
16
|
|
|
use Symfony\Component\Config\FileLocator; |
|
17
|
|
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; |
|
18
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
|
|
|
|
|
19
|
|
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
|
20
|
|
|
use Symfony\Component\DependencyInjection\Reference; |
|
21
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* This is the class that loads and manages the bundle configuration. |
|
25
|
|
|
* |
|
26
|
|
|
* To learn more see {@link https://symfony.com/doc/5.4/bundles/extension.html} |
|
27
|
|
|
*/ |
|
28
|
|
|
class DataTablesExtension extends Extension implements CompilerPassInterface |
|
29
|
|
|
{ |
|
30
|
|
|
/** |
|
31
|
|
|
* {@inheritdoc} |
|
32
|
|
|
*/ |
|
33
|
1 |
|
public function load(array $configs, ContainerBuilder $container) |
|
34
|
|
|
{ |
|
35
|
1 |
|
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
36
|
1 |
|
$loader->load('datatables.yml'); |
|
37
|
1 |
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* {@inheritdoc} |
|
41
|
|
|
*/ |
|
42
|
1 |
|
public function process(ContainerBuilder $container) |
|
43
|
|
|
{ |
|
44
|
1 |
|
if (!$container->has('datatables')) { |
|
45
|
|
|
return; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
1 |
|
$definition = $container->findDefinition('datatables'); |
|
49
|
1 |
|
$services = $container->findTaggedServiceIds('datatable'); |
|
50
|
|
|
|
|
51
|
|
|
foreach ($services as $id => $tags) { |
|
52
|
1 |
|
foreach ($tags as $tag) { |
|
53
|
|
|
$definition->addMethodCall('addService', [ |
|
54
|
|
|
new Reference($id), |
|
55
|
|
|
$tag['id'] ?? null, |
|
56
|
|
|
]); |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths