| Server IP : 217.160.0.212 / Your IP : 216.73.217.138 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1073854427 ( 1073854427) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/share/php/Doctrine/DBAL/Tools/Console/ConnectionProvider/ |
Upload File : |
<?php
namespace Doctrine\DBAL\Tools\Console\ConnectionProvider;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Tools\Console\ConnectionNotFound;
use Doctrine\DBAL\Tools\Console\ConnectionProvider;
use function sprintf;
class SingleConnectionProvider implements ConnectionProvider
{
private Connection $connection;
private string $defaultConnectionName;
public function __construct(Connection $connection, string $defaultConnectionName = 'default')
{
$this->connection = $connection;
$this->defaultConnectionName = $defaultConnectionName;
}
public function getDefaultConnection(): Connection
{
return $this->connection;
}
public function getConnection(string $name): Connection
{
if ($name !== $this->defaultConnectionName) {
throw new ConnectionNotFound(sprintf('Connection with name "%s" does not exist.', $name));
}
return $this->connection;
}
}