Gets the named connection.
public getConnection ( string $name = null ) : Doctrine\DBAL\Connection | ||
$name | string | The connection name (null for the default one) |
Результат | Doctrine\DBAL\Connection |
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'); }