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
Beispiel #1
0
 public function setUp()
 {
     // Enable logging
     ORM::configure('logging', true);
     // Set up the dummy database connection
     $db = new MockPDO('sqlite::memory:');
     ORM::set_db($db);
 }
 public function setUp()
 {
     // Set up the dummy database connections
     ORM::set_db(new MockPDO('sqlite::memory:'));
     ORM::set_db(new MockDifferentPDO('sqlite::memory:'), self::ALTERNATE);
     // Enable logging
     ORM::configure('logging', true);
     ORM::configure('logging', true, self::ALTERNATE);
 }
Beispiel #3
0
 public function tearDown()
 {
     ORM::configure('logging', false);
     ORM::set_db(null);
     ORM::configure('id_column', 'id');
 }