*/ class AdapterFactoryManagerPass implements CompilerPassInterface { public function process(ContainerBuilder $container) { if (!$container->hasDefinition('knplabs_gaufrette.adapter_factory_manager')) { return; } $definition = $container->getDefinition('knplabs_gaufrette.adapter_factory_manager'); $calls = $definition->getMethodCalls(); $definition->setMethodCalls(array()); foreach ($container->findTaggedServiceIds('gaufrette.adapter_factory') as $id => $attributes) { if (!empty($attributes['type'])) { $definition->addMethodCall('set', array($attributes['type'], new Reference($id))); } } $definition->setMethodCalls(array_merge($definition->getMethodCalls(), $calls)); } }