Create db adapter service

@param ServiceLocatorInterface $container
@return Adapter
489712
public function createService(ServiceLocatorInterface $container)
    {
        $config = $container->get(DbOptions::class);
        return new Adapter($config->toArray());
    }
297236
public function createRepositoryFactory(ContainerInterface $container)
    {
        if (empty($this->configFile)) {
            $this->configFile = $container->get('ConfigDirectory') . '/config/database.ini';
        }

        $config = parse_ini_file($this->configFile, true);

        $configuration = new Configuration;

        // Add logger
        $logger = new DebugStack;
        $configuration->setSQLLogger($logger);

        $connection = DriverManager::getConnection(
            [
                'url'     => $config['databaseUrl'],
                'charset' => 'utf8',
            ],
            $configuration
        );
        $transactor = new DoctrineTransactor($connection);

        $repositoryFactory = new RepositoryFactory($config, $connection, $transactor);

        if ($container->has('dispatcher')) {
            $repositoryFactory->setDispatcher($container->get('dispatcher'));
        }

        return $repositoryFactory;
    }
890513
public function loadContextInstancesByContainer(ContainerInterface $container)
    {

        // initialize the array for the context instances
        $contextInstances = array();

        // iterate over all applications and create the context configuration
        foreach (glob($container->getAppBase() . '/*', GLOB_ONLYDIR) as $webappPath) {
            $context = $this->loadContextInstance($container->getContainerNode(), $webappPath);
            $contextInstances[$context->getName()] = $context;
        }

        // return the array with the context instances
        return $contextInstances;
    }
443836
public function buildService(Container $container, ArrayResolver $serviceConfig, $serviceName) {
        $object = $this->activate($container, $serviceConfig, $serviceName);

        // Singleton by default to prevent stack explosions
        if ($serviceConfig->resolve('singleton', true)) {
            // Only store if singleton'ed to spare memory
            $container->bind($serviceName, $object);
        }

        $this->inject($container, $object, $serviceConfig);

        return $object;
    }
681503
public static function registerDefaultServices(ContainerInterface $container)
    {
        if (!$container->has('argv')) {
            $container['argv'] = $_SERVER['argv'];
        }

        if (!$container->has('Debug')) {
            $container['Debug'] = function (ContainerInterface $c) {
                return new DebugMiddleware($c);
            };
        }

        if (!$container->has('Database')) {
            $container['Database'] = function (ContainerInterface $c) {
                return new DatabaseMiddleware($c);
            };
        }

        if (!$container->has('Console')) {
            $container['Console'] = function (ContainerInterface $c) {
                return new ConsoleMiddleware($c);
            };
        }

        if (!$container->has('callableResolver')) {
            /**
             * Instance of \Slim\Interfaces\CallableResolverInterface
             *
             * @param ContainerInterface $c
             *
             * @return CallableResolver
             */
            $container['callableResolver'] = function (ContainerInterface $c) {
                return new CallableResolver($c);
            };
        }
    }
1319332
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $service = new Environment();

        /** @var EnvironmentRepositoryInterface $environmentRepository */
        $environmentRepository = $serviceLocator->get('EnvironmentRepository');
        $service->setEnvironmentRepository($environmentRepository);

        return $service;
    }
102783
public function createService(ServiceLocatorInterface $container)
    {
        // Retrieve the parent container when under zend-servicemanager v2
        if (method_exists($container, 'getServiceLocator')) {
            $container = $container->getServiceLocator() ?: $container;
        }

        return $this($container, DoctrineWriter::class);
    }
219538
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /* @var $options ModuleOptionsInterface */
        $options = $serviceLocator->get(ModuleOptions::class);

        $chain = new AdapterChain;
        $eventManager = $chain->getEventManager();

        // iterate and attach multiple adapters and events if offered
        foreach ($options->getAuthenticationAdapters() as $priority => $adapterName) {
            $adapter = $serviceLocator->get($adapterName);
            if (is_callable(array($adapter, 'authenticate'))) {
                $eventManager->attach('authenticate', [$adapter, 'authenticate'], $priority);
            }
            if (is_callable(array($adapter, 'logout'))) {
                $eventManager->attach('logout', [$adapter, 'logout'], $priority);
            }
        }

        return $chain;
    }
1328339
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var ServiceManager $serviceManager */
        $serviceManager = $serviceLocator->getServiceLocator();

        $controller = new ReportsController();

        /** @var EnvironmentRepositoryInterface $environmentRepository */
        $environmentRepository = $serviceManager->get('EnvironmentRepository');
        $controller->setEnvironmentRepository($environmentRepository);

        return $controller;
    }
1216068
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $this->getConfig($serviceLocator);

        if (!isset($config['cache'])) {
            return null;
        }

        $config = $config['cache'];
        /* @var $cache CacheProvider|Cache */
        $cache = null;
        $cacheFactory = $this->getCacheFactory($config);
        $cache = $cacheFactory->newInstance($config);

        if (isset($config['namespace'])) {
            $cache->setNamespace(trim($config['namespace']));
        }

        return $cache;
    }
696840
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $appServiceLocator = $serviceLocator;
        if ($serviceLocator instanceof AbstractPluginManager) {
            $appServiceLocator = $serviceLocator->getServiceLocator();
        }

        /** @var DoctrineObjectManager $doctrineObjectManager */
        $doctrineObjectManager = $appServiceLocator->get(DoctrineObjectManager::class);

        /** @var EntityMapCacheInterface $entityMapCache */
        $entityMapCache = $appServiceLocator->get(EntityMapCacheInterface::class);

        return new EntityMapBuilderController($doctrineObjectManager, $entityMapCache);
    }
430406
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $mapper = new UserRoleLinkerMapper;
        $options = $serviceLocator->get('UserRbac\ModuleOptions');
        $class = $options->getUserRoleLinkerEntityClass();
        $mapper->setEntityPrototype(new $class);
        $mapper->setDbAdapter($serviceLocator->get('UserRbac\DbAdapter'));
        $mapper->setTableName($options->getTableName());

        return $mapper;
    }
415323
public function register(Container $container)
    {
        $container->prepareSharedObject(DatabaseService::class);

        $closure = function (Container $container) {
            $service = $container->get(DatabaseService::class);

            return $service->createConnection();
        };

        class_alias(AbstractDatabaseDriver::class, DatabaseAdapter::class);
        $container->share(AbstractDatabaseDriver::class, $closure)
            ->alias(DatabaseAdapter::class, AbstractDatabaseDriver::class);

        DatabaseContainer::setDb(function () use ($container) {
            return $container->get(AbstractDatabaseDriver::class);
        });

        // For Exporter
        $closure = function (Container $container) {
            $service = $container->get(DatabaseService::class);

            return $service->getExporter();
        };

        $container->share(AbstractExporter::class, $closure);
    }
242904
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('ZfcUserLdap\LdapConfig');
        $logger = $serviceLocator->get('ZfcUserLdap\Logger');
        $zulconfig = $serviceLocator->get('ZfcUserLdap\Config');

        return new \ZfcUserLdap\Adapter\Ldap($config, $logger, $zulconfig['logging']['log_enabled']);
    }
405325
public function get(ContainerInterface $container = null)
    {
        if (empty($this->arguments)) {
            $instance = new $this->class();
        } else {
            $ref = new \ReflectionClass($this->class);
            $instance = $ref->newInstanceArgs($this->prepare($container, $this->arguments));
        }

        return $this->executeMethods($instance, $container);
    }
279931
protected function loadServiceProviders( Container $container ) {
		$container[ WPEMERGE_SERVICE_PROVIDERS_KEY ] = array_merge(
			$this->service_providers,
			$container[ WPEMERGE_CONFIG_KEY ]['providers']
		);

		$service_providers = array_map( function ( $service_provider ) {
			if ( ! is_subclass_of( $service_provider, ServiceProviderInterface::class ) ) {
				throw new ConfigurationException(
					'The following class does not implement ' .
					'ServiceProviderInterface: ' . $service_provider
				);
			}

			return new $service_provider();
		}, $container[ WPEMERGE_SERVICE_PROVIDERS_KEY ] );

		$this->registerServiceProviders( $service_providers, $container );
		$this->bootstrapServiceProviders( $service_providers, $container );
	}
1307839
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var EntityManagerInterface $objectManager */
        $objectManager = $serviceLocator->get('Doctrine\ORM\EntityManager');

        /** @var ValidatorPluginManager $validatorPluginManager */
        $validatorPluginManager = $serviceLocator->get('ValidatorManager');

        return new DoctrineORMProvider($objectManager, $validatorPluginManager);
    }