-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathValksorConfiguration.php
More file actions
95 lines (88 loc) · 3.2 KB
/
Copy pathValksorConfiguration.php
File metadata and controls
95 lines (88 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php declare(strict_types = 1);
/*
* This file is part of the Valksor package.
*
* (c) Davis Zalitis (k0d3r1s)
* (c) SIA Valksor <packages@valksor.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Valksor\Bundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
final class ValksorConfiguration extends AbstractDependencyConfiguration
{
public function addSection(
ArrayNodeDefinition $rootNode,
callable $enableIfStandalone,
string $component,
): void {
$rootNode
->children()
->arrayNode('project')
->info('Project directory structure configuration')
->addDefaultsIfNotSet()
->children()
->scalarNode('apps_dir')
->info('Directory containing applications (relative to project root)')
->defaultNull()
->example('apps')
->end()
->scalarNode('infrastructure_dir')
->info('Directory containing shared resources (relative to project root)')
->defaultNull()
->example('infrastructure')
->end()
->arrayNode('autoload')
->info('Autoload configuration')
->addDefaultsIfNotSet()
->children()
->scalarNode('namespace_prefix')
->info('Namespace prefix for generated autoload classes')
->defaultNull()
->end()
->end()
->end()
->end()
->end();
}
public function registerGlobalMigrations(
ContainerConfigurator $container,
ContainerBuilder $builder,
): void {
if ($builder->hasExtension('doctrine')) {
if ($builder->hasExtension('doctrine_migrations')) {
$container->extension('doctrine_migrations', [
'migrations_paths' => [
'Valksor\\Bundle\\Migrations' => __DIR__ . '/../Resources/migrations',
],
]);
}
}
}
public function registerPreConfiguration(
ContainerConfigurator $container,
ContainerBuilder $builder,
string $component,
): void {
if ($builder->hasExtension('framework')) {
$container->extension('framework', [
'set_locale_from_accept_language' => true,
]);
}
}
public static function getDefaults(): array
{
return [
'project' => [
'apps_dir' => 'apps',
'infrastructure_dir' => 'infrastructure',
'autoload' => [
'namespace_prefix' => 'Application',
],
],
];
}
}