Files
contao-leaflet-maps/src/DependencyInjection/Pass/RegisterEncodersPass.php

45 lines
1.4 KiB
PHP
Raw Normal View History

2017-10-06 15:35:02 +02:00
<?php
/**
* Leaflet maps for Contao CMS.
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\DependencyInjection\Pass;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* Register all definition encoders.
*
* @package Netzmacht\Contao\Leaflet\DependencyInjection\Pass
*/
class RegisterEncodersPass implements CompilerPassInterface
{
/**
* {@inheritDoc}
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('netzmacht.contao_leaflet_maps.definition.builder.event_dispatcher')) {
return;
}
$definition = $container->getDefinition('netzmacht.contao_leaflet_maps.definition.builder.event_dispatcher');
$serviceIds = $container->findTaggedServiceIds('netzmacht.contao_leaflet_maps.encoder');
2017-10-06 15:53:26 +02:00
foreach (array_keys($serviceIds) as $serviceId) {
2017-10-06 15:35:02 +02:00
$definition->addMethodCall('addSubscriber', [new Reference($serviceId)]);
}
}
}