1
0
mirror of synced 2025-01-08 10:07:10 +03:00
doctrine2/manual/codes/Working with objects - Component overview - Manager - Managing connections.php

26 lines
573 B
PHP

<?php
// Doctrine_Manager controls all the connections
$manager = Doctrine_Manager::getInstance();
// open first connection
$conn = $manager->openConnection(new PDO('dsn','username','password'), 'connection 1');
// open second connection
$conn2 = $manager->openConnection(new PDO('dsn2','username2','password2'), 'connection 2');
$manager->getCurrentConnection(); // $conn2
$manager->setCurrentConnection('connection 1');
$manager->getCurrentConnection(); // $conn
// iterating through connections
foreach($manager as $conn) {
}
?>