public static function getConnection($name = null, $mode = Propel::CONNECTION_WRITE)
    {
        if ($name === null) {
            $name = self::getDefaultDB();
        }

        // IF a WRITE-mode connection was requested
        // or Propel is configured to always use the master connection
        // THEN return the master connection.
        if ($mode != Propel::CONNECTION_READ || self::$forceMasterConnection) {
            return self::getMasterConnection($name);
        } else {
            return self::getSlaveConnection($name);
        }
    }