Build the connection factory instance.

@param  ConnectionResolverInterface  $connectionResolver
428998
protected function setupConnectionFactory(ConnectionResolverInterface $connectionResolver)
    {
        Model::setConnectionResolver($connectionResolver);

        $this->connectionFactory = new ConnectionFactory($connectionResolver);
    }
647398
private static function setConnectionCollation(Connection $connection, array $options = array())
    {
        if (isset($options['collation'])) {
            try {
                if ('pdo_mysql' === $connection->getDriver()->getName()) {
                    $connection->executeQuery('SET SESSION collation_connection = "'.addslashes($options['collation']).'";');
                }
            } catch (\Exception $e) {
                throw new InvalidArgumentException(
                    sprintf('Invalid database collation `%s`', $options['collation']),
                    InvalidArgumentException::INVALID_ARGUMENT,
                    $e
                );
            }
        }
    }
221231
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var $env Environment */
        $env = $serviceLocator->get('processing.env');

        return new ProcessFactory($env->getConfig()->arrayValue('processes'));
    }
768765
public function onOpen(ConnectionInterface $connection)
    {
        $connection->PeriodicTimer = new ConnectionPeriodicTimer($connection, $this->loop);

        return $this->decorated->onOpen($connection);
    }
1074827
protected function createConnection($connectionID)
    {
        $separator = strrpos($connectionID, ':');

        return $this->connections->create(array(
            'host' => substr($connectionID, 0, $separator),
            'port' => substr($connectionID, $separator + 1),
        ));
    }
820426
public static function setupDatabaseResolver(PDO $pdo, $driverName = null, $tablePrefix = '')
	{
		// If Eloquent doesn't exist, then we must assume they are using their own providers.
		if (class_exists('Illuminate\Database\Eloquent\Model'))
		{
			if (is_null($driverName))
			{
				$driverName = $pdo->getAttribute(PDO::ATTR_DRIVER_NAME);
			}

			Eloquent::setConnectionResolver(new ConnectionResolver($pdo, $driverName, $tablePrefix));
		}
	}
1252764
public function build(ConnectionInterface $connection, IlluminateSchemaGrammar $grammar)
    {
        foreach ($this->toCypher($connection, $grammar) as $statement)
        {
            $connection->statement($statement);
        }
    }
375945
public function formalize(Settings $settings, TransportConnectionFactoryInterface $connectionFactory)
    {
        $durableMessagingEnabled = $this->isDurableMessagingEnabled($settings);
        /** @var AMQPConnection $connection */
        $connection = $connectionFactory->createConnection();
        return new RabbitMqTransportInfrastructure(
            $settings,
            new RoutingTopology($durableMessagingEnabled),
            new BrokerModel($connection),
            $durableMessagingEnabled
        );
    }
1079247
protected function connect(string $connectionName): Connection
	{
		if(!isset($this->configurations[$connectionName]))
		{
			throw new RuntimeException(vsprintf('[ %s ] has not been defined in the database configuration.', [$connectionName]));
		}

		$config = $this->configurations[$connectionName];

		$driver = $this->normalizeDriverName(explode(':', $config['dsn'], 2)[0]);

		$compiler = $this->getQueryCompilerClass($driver);

		$helper = $this->getQueryBuilderHelperClass($driver);

		$connection = $this->getConnectionClass($driver);

		return new $connection($connectionName, $compiler, $helper, $config);
	}
728767
public function configureOptionsResolver(OptionsResolver $resolver)
    {
        parent::configureOptionsResolver($resolver);
        $resolver->setRequired(self::OPTION_BASE_PATH);
        $resolver->setAllowedTypes(self::OPTION_BASE_PATH, ['string']);
        $resolver->setRequired(self::OPTION_FILENAME);
        $resolver->setAllowedTypes(self::OPTION_FILENAME, ['string']);
        $resolver->setRequired(self::OPTION_TYPE);
        $resolver->setAllowedTypes(self::OPTION_TYPE, ['string']);
        $resolver->setAllowedValues(self::OPTION_TYPE, [self::OPTION_TYPE_VALUE_BODY, self::OPTION_TYPE_VALUE_HEADERS]);
    }
1080119
protected function addActiveConnection(ConnectionInterface $connection)
    {
        if (!$this->activeConnections) {
            $this->activeConnections = new \SplObjectStorage;
        }
        $this->activeConnections->attach($connection);
    }
706152
public function setConnection($name, ConnectionInterface $connection)
    {
        $manager = new ConnectionManagerSingle();
        $manager->setConnection($connection);
        $this->setConnectionManager($name, $manager);
    }
832192
public function queryBuilder(ConnectionInterface $connection, String $connectionId=null) : QueryBuilderProvider
	{
		return new QueryBuilder($connection, $connectionId);
	}
1228148
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $resolver = new AggregateResolver();
        $resolver->attach($serviceLocator->get('GkSmartyTemplateMapResolver'));
        $resolver->attach($serviceLocator->get('GkSmartyTemplatePathStack'));

        return $resolver;
    }
390027
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        return new ConnectionManager(
            $serviceLocator->get('prooph.link.app.config_location'),
            $serviceLocator->get('prooph.link.system_config.config_writer'),
            $serviceLocator->get('prooph.link.sqlconnector.dbal_connections')
        );
    }
206058
private function buildResolver(): OptionsResolver
    {
        $resolver = new OptionsResolver();
        $profile = $this->mapOfProfiles->get($this->currentProfile);

        call_user_func($profile, $resolver);

        return $resolver;
    }
1190736
public function makeRaw(string $connectionName = ''): RawQueryBuilder
    {
        $connection = $this->provideConnection($connectionName);
        $statementBuilder = new RawStatementBuider;
        return new RawQueryBuilder($connection, $statementBuilder);
    }