public static function create($module, $description = '', $connection = NULL) { if (self::isEnabled($module)) { return TRUE; } if (is_null($connection)) { $connection = array(); } $defaults = Kohana::config('database.default.connection'); $odbc = new Odbc(); // Put our defaults in first $odbc->fromArray($defaults); // Clobber our defaults (intentionally) with user settings, if any $odbc->fromArray($connection); /* look up the port by type since its a required field. */ $odbc->port = self::lookupPort($odbc->type); $odbc->dsn_name = 'bluebox'; $odbc->module = $module; $odbc->xpath = $xpath; $odbc->description = $description; $odbc->enabled = TRUE; try { $odbc->save(); } catch (Doctrine_Validator_Exception $e) { // will never get here } return TRUE; }