-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathAPYBreadcrumbTrailExtension.php
More file actions
46 lines (38 loc) · 1.67 KB
/
APYBreadcrumbTrailExtension.php
File metadata and controls
46 lines (38 loc) · 1.67 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
<?php
/*
* This file is part of the APYBreadcrumbTrailBundle.
*
* (c) Abhoryo <abhoryo@free.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace APY\BreadcrumbTrailBundle\DependencyInjection;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\HttpKernel\Kernel;
class APYBreadcrumbTrailExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$container->setParameter('apy_breadcrumb_trail.template', $config['template']);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');
$this->deprecateService($container, 'apy_breadcrumb_trail');
$this->deprecateService($container, 'apy_breadcrumb_trail.annotation.listener');
}
private function deprecateService(ContainerBuilder $container, string $id)
{
$alias = $container->getAlias($id);
if (version_compare(Kernel::VERSION, '5.1.0', '>=')) {
$alias->setDeprecated('APY/BreadcrumbTrailBundle', '1.7', 'The service is deprecated, use "%alias_id%" FQCN as service id instead.');
} elseif (version_compare(Kernel::VERSION, '4.3.0', '>=')) {
/* @phpstan-ignore-next-line */
$alias->setDeprecated();
}
}
}