/** * * @param int $idx * @param array $configArray * @throws AiryException */ public static function assignDbAccess($idx, $configArray) { if (!isset($configArray['dbtype'])) { throw new AiryException("no dbtype setting in the config.ini"); } //pdo is the default connection type $connectionType = "pdo"; if (isset($configArray['connection_type'])) { $connectionType = $configArray['connection_type']; } else { if (strtolower($configArray['dbtype']) == "mongodb") { $connectionType = "mongodb"; } } if (strtolower($connectionType) == "pdo") { $access = new PdoAccess(); } else { if (strtolower($connectionType) == "mongodb") { $access = new MongoDbAccess(); } else { $access = new DbAccess(); } } //set and put into array $access->config($idx); self::$dbAccessElements[$idx] = $access; }