/** * @param Sabel_Db_Driver $driver * * @throws Sabel_Db_Exception_Connection * @return Sabel_Db_Driver */ protected static function _connect(Sabel_Db_Driver $driver) { $connectionName = $driver->getConnectionName(); $names = Sabel_Db_Config::getConnectionNamesOfSameSetting($connectionName); foreach ($names as $name) { if (isset(self::$connections[$name])) { $driver->setConnection(self::$connections[$name]); return $driver; } } if (!isset(self::$connections[$connectionName])) { $result = $driver->connect(Sabel_Db_Config::get($connectionName)); if (is_string($result)) { throw new Sabel_Db_Exception_Connection($result); } else { self::$connections[$connectionName] = $result; } } $driver->setConnection(self::$connections[$connectionName]); return $driver; }