/**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     if (!empty($config['repository'])) {
         //Main Repo
         $container->setDefinition($config['repository_key'], new \Symfony\Component\DependencyInjection\Definition($config['repository_factory'], array('em' => new \Symfony\Component\DependencyInjection\Reference('em'), 'map' => $config['repository'], 'container' => new \Symfony\Component\DependencyInjection\Reference('service_container'))));
         foreach ($config['repository'] as $key => $options) {
             $definition = new \Symfony\Component\DependencyInjection\Definition($config['repository_factory'], array($key));
             $definition->setFactoryService($config['repository_key']);
             $definition->setFactoryMethod('get');
             $container->setDefinition($config['repository_key'] . '.' . $key, $definition);
         }
     }
 }
예제 #2
0
 public function toSymfonyDefinition(tubepress_api_ioc_DefinitionInterface $definition)
 {
     if ($definition instanceof tubepress_internal_ioc_Definition) {
         return $definition->getUnderlyingSymfonyDefinition();
     }
     $cleanedArguments = $this->convertToSymfonyReferenceIfNecessary($definition->getArguments());
     $cleanedMethodCalls = $this->convertToSymfonyReferenceIfNecessary($definition->getMethodCalls());
     $toReturn = new \Symfony\Component\DependencyInjection\Definition($definition->getClass(), $cleanedArguments);
     $toReturn->setConfigurator($definition->getConfigurator());
     $toReturn->setDecoratedService($definition->getDecoratedService());
     $toReturn->setFactoryClass($definition->getFactoryClass());
     $toReturn->setFactoryMethod($definition->getFactoryMethod());
     $toReturn->setFactoryService($definition->getFactoryService());
     $toReturn->setFile($definition->getFile());
     $toReturn->setMethodCalls($cleanedMethodCalls);
     $toReturn->setProperties($definition->getProperties());
     $toReturn->setTags($definition->getTags());
     return $toReturn;
 }