1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Veslo project <https://github.com/symfony-doge/veslo>. |
5
|
|
|
* |
6
|
|
|
* (C) 2019 Pavel Petrov <[email protected]>. |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* @license https://opensource.org/licenses/GPL-3.0 GPL-3.0 |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
declare(strict_types=1); |
15
|
|
|
|
16
|
|
|
namespace Veslo\AnthillBundle\DependencyInjection; |
17
|
|
|
|
18
|
|
|
use Symfony\Component\Config\FileLocator; |
19
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
20
|
|
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
21
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* AnthillBundle dependency injection extension. |
25
|
|
|
*/ |
26
|
|
|
class VesloAnthillExtension extends Extension |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* {@inheritdoc} |
30
|
|
|
*/ |
31
|
|
|
public function load(array $configs, ContainerBuilder $container) |
32
|
|
|
{ |
33
|
|
|
$locator = new FileLocator(__DIR__ . implode(DIRECTORY_SEPARATOR, ['', '..', 'Resources'])); |
34
|
|
|
$loader = new YamlFileLoader($container, $locator); |
35
|
|
|
|
36
|
|
|
$configFiles = [ |
37
|
|
|
'commands.yml', |
38
|
|
|
'controllers.yml', |
39
|
|
|
'event_listeners.yml', |
40
|
|
|
'entity_repositories.yml', |
41
|
|
|
'entity_creators.yml', |
42
|
|
|
'providers.yml', |
43
|
|
|
'normalizers.yml', |
44
|
|
|
'fixtures.yml', |
45
|
|
|
'roadmaps.yml', |
46
|
|
|
'scanner_pools.yml', |
47
|
|
|
'workers.yml', |
48
|
|
|
'queues.yml', |
49
|
|
|
'menu.yml', |
50
|
|
|
'services.yml', |
51
|
|
|
]; |
52
|
|
|
|
53
|
|
|
foreach ($configFiles as $configFile) { |
54
|
|
|
$loader->load('config' . DIRECTORY_SEPARATOR . $configFile); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
$configuration = new Configuration(); |
58
|
|
|
$config = $this->processConfiguration($configuration, $configs); |
59
|
|
|
|
60
|
|
|
// Digging parameters. |
61
|
|
|
$container->setParameter( |
62
|
|
|
'veslo.anthill.vacancy.digging.roadmap.attempts_until_pause', |
63
|
|
|
$config['vacancy']['digging']['roadmap']['attempts_until_pause'] |
64
|
|
|
); |
65
|
|
|
$container->setParameter( |
66
|
|
|
'veslo.anthill.vacancy.digging.roadmap.pause_duration', |
67
|
|
|
$config['vacancy']['digging']['roadmap']['pause_duration'] |
68
|
|
|
); |
69
|
|
|
|
70
|
|
|
// Provider options. |
71
|
|
|
$container->setParameter( |
72
|
|
|
'veslo.anthill.vacancy.provider.journal.options', |
73
|
|
|
[ |
74
|
|
|
'per_page' => $config['vacancy']['provider']['journal']['per_page'], |
75
|
|
|
'max_days_after_publication' => $config['vacancy']['provider']['journal']['max_days_after_publication'], |
76
|
|
|
] |
77
|
|
|
); |
78
|
|
|
$container->setParameter( |
79
|
|
|
'veslo.anthill.vacancy.provider.archive.options', |
80
|
|
|
[ |
81
|
|
|
'per_page' => $config['vacancy']['provider']['archive']['per_page'], |
82
|
|
|
'min_days_after_publication' => $config['vacancy']['provider']['archive']['min_days_after_publication'], |
83
|
|
|
] |
84
|
|
|
); |
85
|
|
|
|
86
|
|
|
// Vacancy repository options. |
87
|
|
|
$container->setParameter( |
88
|
|
|
'veslo.anthill.vacancy_repository.options', |
89
|
|
|
[ |
90
|
|
|
'cache_result_namespace' => $config['vacancy']['repository']['cache_result_namespace'], |
91
|
|
|
'cache_result_lifetime' => $config['vacancy']['repository']['cache_result_lifetime'], |
92
|
|
|
] |
93
|
|
|
); |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|