/** Returns the name of the Doctrine database. * * @throws RuntimeException If the active connection has no DSN. * @return string */ protected function getDatabaseName() { /* Why oh why does Doctrine_Connection not do this for us? */ /** @noinspection PhpVoidFunctionResultUsedInspection */ if (!($dsn = $this->_connection->getOption('dsn'))) { throw new RuntimeException(sprintf('Doctrine connection "%s" does not have a DSN!', $this->_connection->getName())); } $info = $this->_connection->getManager()->parsePdoDsn($dsn); return isset($info['dbname']) ? $info['dbname'] : null; }