2006-07-24 01:08:06 +04:00
|
|
|
<?php
|
2006-08-22 02:51:27 +04:00
|
|
|
// Doctrine_Manager controls all the connections
|
2006-07-24 01:08:06 +04:00
|
|
|
|
|
|
|
$manager = Doctrine_Manager::getInstance();
|
|
|
|
|
2006-08-22 02:51:27 +04:00
|
|
|
// open first connection
|
2006-07-24 01:08:06 +04:00
|
|
|
|
2006-08-22 02:51:27 +04:00
|
|
|
$conn = $manager->openConnection(new PDO("dsn","username","password"), "connection 1");
|
2006-07-24 01:08:06 +04:00
|
|
|
|
2006-08-22 02:51:27 +04:00
|
|
|
// open second connection
|
2006-07-24 01:08:06 +04:00
|
|
|
|
2006-08-22 02:51:27 +04:00
|
|
|
$conn2 = $manager->openConnection(new PDO("dsn2","username2","password2"), "connection 2");
|
2006-07-24 01:08:06 +04:00
|
|
|
|
2006-08-22 02:51:27 +04:00
|
|
|
$manager->getCurrentConnection(); // $conn2
|
2006-07-24 01:08:06 +04:00
|
|
|
|
2006-08-22 02:51:27 +04:00
|
|
|
$manager->setCurrentConnection("connection 1");
|
2006-07-24 01:08:06 +04:00
|
|
|
|
2006-08-22 02:51:27 +04:00
|
|
|
$manager->getCurrentConnection(); // $conn
|
2006-07-24 01:08:06 +04:00
|
|
|
|
2006-08-22 02:51:27 +04:00
|
|
|
// iterating through connections
|
2006-07-24 01:08:06 +04:00
|
|
|
|
2006-08-22 02:51:27 +04:00
|
|
|
foreach($manager as $conn) {
|
2006-07-24 01:08:06 +04:00
|
|
|
|
|
|
|
}
|
|
|
|
?>
|