1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace LAG\AdminBundle\DependencyInjection; |
6
|
|
|
|
7
|
|
|
use Symfony\Component\Config\FileLocator; |
8
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
|
|
|
9
|
|
|
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; |
10
|
|
|
use Symfony\Component\DependencyInjection\Loader; |
11
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
12
|
|
|
|
13
|
|
|
class LAGAdminExtension extends Extension implements PrependExtensionInterface |
14
|
|
|
{ |
15
|
3 |
|
public function load(array $configs, ContainerBuilder $container): void |
16
|
|
|
{ |
17
|
3 |
|
$configuration = new Configuration(); |
18
|
3 |
|
$config = $this->processConfiguration($configuration, $configs); |
19
|
|
|
|
20
|
3 |
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../../config')); |
21
|
3 |
|
$loader->load('services.yaml'); |
22
|
|
|
|
23
|
3 |
|
if ($container->getParameter('kernel.environment') === 'dev') { |
24
|
2 |
|
$loader->load('services_dev.yaml'); |
25
|
|
|
} |
26
|
|
|
$container->setParameter('lag_admin.application.configuration', $config); |
27
|
3 |
|
$container->setParameter('lag_admin.resource_paths', $config['resource_paths']); |
28
|
|
|
$container->setParameter('lag_admin.translation_domain', $config['translation_domain']); |
29
|
|
|
$container->setParameter('lag_admin.title', $config['title']); |
30
|
|
|
$container->setParameter('lag_admin.date_format', $config['date_format']); |
31
|
3 |
|
$container->setParameter('lag_admin.time_format', $config['time_format']); |
32
|
|
|
$container->setParameter('lag_admin.date_localization', $config['date_localization']); |
33
|
|
|
} |
34
|
3 |
|
|
35
|
3 |
|
public function getAlias(): string |
36
|
|
|
{ |
37
|
3 |
|
return 'lag_admin'; |
38
|
3 |
|
} |
39
|
3 |
|
|
40
|
3 |
|
public function prepend(ContainerBuilder $container): void |
41
|
3 |
|
{ |
42
|
3 |
|
$configs = $container->getExtensionConfig($this->getAlias()); |
43
|
|
|
$resolvingBag = $container->getParameterBag(); |
44
|
1 |
|
$configs = $resolvingBag->resolveValue($configs); |
45
|
|
|
$config = $this->processConfiguration(new Configuration(), $configs); |
46
|
1 |
|
|
47
|
|
|
// // TODO remove this and pass when calling template instead |
48
|
|
|
// $container->prependExtensionConfig('knp_menu', [ |
49
|
1 |
|
// 'twig' => [ |
50
|
|
|
// 'template' => '@LAGAdmin/menu/menu-base.html.twig', |
51
|
1 |
|
// ], |
52
|
|
|
// ]); |
53
|
1 |
|
|
54
|
|
|
$container->prependExtensionConfig('twig', [ |
55
|
|
|
'form_themes' => ['@LAGAdmin/form/theme.html.twig'], |
56
|
1 |
|
'globals' => [ |
57
|
1 |
|
'lag_admin_translation_catalog' => $config['translation_domain'], |
58
|
|
|
], |
59
|
1 |
|
]); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|
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