ORM::set_db PHP Method

set_db() public static method

This is public in case the ORM should use a ready-instantiated PDO object as its database connection. Accepts an optional string key to identify the connection if multiple connections are used.
public static set_db ( PDO $db, string $connection_name = self::DEFAULT_CONNECTION )
$db PDO
$connection_name string Which connection to use
    public static function set_db($db, $connection_name = self::DEFAULT_CONNECTION)
    {
        self::_setup_db_config($connection_name);
        self::$_db[$connection_name] = $db;
        if (!is_null(self::$_db[$connection_name])) {
            self::_setup_identifier_quote_character($connection_name);
            self::_setup_limit_clause_style($connection_name);
        }
    }

Usage Example

 public function tearDown()
 {
     ORM::configure('logging', false);
     ORM::configure('logging', false, self::ALTERNATE);
     ORM::set_db(null);
     ORM::set_db(null, self::ALTERNATE);
 }
All Usage Examples Of ORM::set_db
ORM