/** * Gets an instance of the database class for a particular database type * and object id. * Database type refers to one of the preconfigured types in Configuration. * Object id is used for sharding. Not all database types use the id. * * @param name * @param id * @returns */ public static function getInstance($name = 'default', $id = '') { if (isset(self::$instances[$name])) { return self::$instances[$name]; } $settings = Configuration::getDatabaseSettings($name); if (!$settings) { $this->Log->LogFATAL("Unrecognized database configuration: " . $name); die('Unrecognized database configuration: ' . $name); } $db = new Core_Database($settings); self::$instances[$name] = $db; return $db; }