public function getAdapter($connectionName, array $options = [])
    {
        if (!isset($this->adapters[$connectionName])) {
            if (!$this->connectionExists($connectionName)) {
                throw new Exception\RuntimeException(
                    sprintf('Connection doesn\'t exist: %s', $connectionName)
                );
            }
            
            $connectionConfig = $this->connections[$connectionName];
            

            if (!isset($connectionConfig['driver'])) {
                throw new Exception\InvalidArgumentException(
                    'A "driver" key to be present inside the database config parameters'
                );
            }
            
            if ($connectionConfig['driver'] == 'mongo') {
                $connection = new MongoConnection($connectionConfig);
                $this->adapters[$connectionName] = $connection;
            } else {
                $driver = DriverCreator::create($connectionName, $connectionConfig);
                
                $adapterParams = [
                    'driver' => $driver
                ];
                
                if (isset($options['allowProfiler']) && !$options['allowProfiler']) {
                    $adapterParams['profiler'] = false;
                }
                
                $adapter = new Adapter($adapterParams);
                $this->adapters[$connectionName] = $adapter;
                $driver->getConnection()->setAdapter($adapter);
                
                if (\Rails::cli()) {
                    $adapter->setProfiler(new \Zend\Db\Adapter\Profiler\Profiler());
                }
            }
        }
        return $this->adapters[$connectionName];
    }