getConnection() public method

Gets the named connection.
public getConnection ( string $name = null ) : Doctrine\DBAL\Connection
$name string The connection name (null for the default one)
return Doctrine\DBAL\Connection
示例#1
0
 public function testGetUnknownConnection()
 {
     $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $registry = new Registry($container, array(), array(), 'default', 'default');
     $this->setExpectedException('InvalidArgumentException', 'Doctrine Connection named "default" does not exist.');
     $registry->getConnection('default');
 }