public function AbstractManagerRegistry::getConnection

Gets the named connection.

Parameters

string $name The connection name (null for the default one):

Return value

object

Overrides ConnectionRegistry::getConnection

File

drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php, line 120

Class

AbstractManagerRegistry
Abstract implementation of the ManagerRegistry contract.

Namespace

Doctrine\Common\Persistence

Code

public function getConnection($name = null) {
  if (null === $name) {
    $name = $this->defaultConnection;
  }
  if (!isset($this->connections[$name])) {
    throw new \InvalidArgumentException(sprintf('Doctrine %s Connection named "%s" does not exist.', $this->name, $name));
  }
  return $this
    ->getService($this->connections[$name]);
}