for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the XabbuhPandaBundle package.
*
* (c) Christian Flothmann <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\PandaBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Reference;
/**
* Implementation of a compiler pass which registers tagged services as
* providers for clouds and accounts on the corresponding managers.
* @author Christian Flothmann <[email protected]>
class ProviderPass implements CompilerPassInterface
{
* {@inheritDoc}
public function process(ContainerBuilder $container)
// add account providers
if ($container->has("xabbuh_panda.account_manager")) {
$accountManager = $container->findDefinition("xabbuh_panda.account_manager");
$accountProviderServices = $container->findTaggedServiceIds("xabbuh_panda.account_provider");
foreach ($accountProviderServices as $id => $tags) {
$accountManager->addMethodCall("registerProvider", array(new Reference($id)));
}
// add cloud providers
if ($container->has("xabbuh_panda.cloud_manager")) {
$cloudManager = $container->findDefinition("xabbuh_panda.cloud_manager");
$cloudProviderServices = $container->findTaggedServiceIds("xabbuh_panda.cloud_provider");
foreach ($cloudProviderServices as $id => $tags) {
$cloudManager->addMethodCall("registerProvider", array(new Reference($id)));