/**
  * @param array            $configs
  * @param ContainerBuilder $container
  */
 private function createResourceServices(array $configs, ContainerBuilder $container)
 {
     foreach ($configs as $name => $config) {
         list($prefix, $resourceName) = explode('.', $name);
         DatabaseDriverFactory::get($config['driver'], $container, $prefix, $resourceName, array_key_exists('templates', $config) ? $config['templates'] : null)->load($config['classes']);
     }
 }
 /**
  * @param array            $configs
  * @param ContainerBuilder $container
  */
 private function createResourceServices(array $configs, ContainerBuilder $container)
 {
     $translationsEnabled = class_exists('Sylius\\Bundle\\TranslationBundle\\DependencyInjection\\Mapper');
     if ($translationsEnabled) {
         $mapper = new Mapper();
     }
     foreach ($configs as $name => $config) {
         list($prefix, $resourceName) = explode('.', $name);
         $manager = isset($config['object_manager']) ? $config['object_manager'] : 'default';
         DatabaseDriverFactory::get($container, $prefix, $resourceName, $manager, $config['driver'], array_key_exists('templates', $config) ? $config['templates'] : null)->load($config['classes']);
         if ($translationsEnabled && array_key_exists('model', $config['classes']) && array_key_exists('translation', $config['classes'])) {
             $mapper->mapTranslations($config['classes'], $container);
             DatabaseDriverFactory::get($container, $prefix, sprintf('%s_translation', $resourceName), $manager, $config['driver'])->load($config['classes']['translation']);
         }
     }
 }
 /**
  * @param array $config
  * @param ContainerBuilder $container
  */
 protected function configureTranslations(array $config, ContainerBuilder $container)
 {
     $driver = $config['driver'];
     $manager = isset($config['object_manager']) ? $config['object_manager'] : 'default';
     $mapper = new Mapper();
     foreach ($config['classes'] as $model => $classes) {
         if (array_key_exists('model', $classes) && array_key_exists('translation', $classes)) {
             $mapper->mapTranslations($classes, $container);
             DatabaseDriverFactory::get($container, $this->applicationName, sprintf('%s_translation', $model), $manager, $driver, isset($config['templates'][$model]) ? $config['templates'][$model] : null)->load($classes['translation']);
         }
     }
 }
 /**
  * Load bundle driver.
  *
  * @param array                 $config
  * @param LoaderInterface       $loader
  * @param null|ContainerBuilder $container
  *
  * @throws InvalidDriverException
  */
 protected function loadDatabaseDriver(array $config, LoaderInterface $loader, ContainerBuilder $container)
 {
     $bundle = str_replace(array('Extension', 'DependencyInjection\\'), array('Bundle', ''), get_class($this));
     $driver = $config['driver'];
     if (!in_array($driver, call_user_func(array($bundle, 'getSupportedDrivers')))) {
         throw new InvalidDriverException($driver, basename($bundle));
     }
     $this->loadConfigurationFile(array(sprintf('driver/%s', $driver)), $loader);
     $container->setParameter($this->getAlias() . '.driver', $driver);
     $container->setParameter($this->getAlias() . '.driver.' . $driver, true);
     foreach ($config['classes'] as $model => $classes) {
         if (array_key_exists('model', $classes)) {
             DatabaseDriverFactory::get($driver, $container, $this->applicationName, $model, isset($config['object_manager']) ? $config['object_manager'] : 'default', isset($config['templates'][$model]) ? $config['templates'][$model] : null)->load($classes);
         }
     }
 }