LazyRecord\ConnectionManager::getConnection PHP Method

getConnection() public method

$dbh = new Connection('mysql:host=localhost;dbname=test', $user, $pass); $pdo = new Connection( 'mysql:host=hostname;dbname=defaultDbName', 'username', 'password', array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8") ); $dbh = new Connection('pgsql:dbname=$dbname; host=$host; username=$username; password=$password'); $pdo = new Connection( 'sqlite::memory:', null, null, array(PDO::ATTR_PERSISTENT => true) ); sqlite2:mydb.sq2
public getConnection ( $sourceId )
    public function getConnection($sourceId)
    {
        if ($sourceId === 'default' && $this->config) {
            $sourceId = $this->config->getDefaultDataSourceId();
        }
        // use cached connection objects
        if (isset($this->conns[$sourceId])) {
            return $this->conns[$sourceId];
        }
        if (!isset($this->datasources[$sourceId])) {
            throw new UndefinedDataSourceException("data source {$sourceId} not found.");
        }
        // Only for MySQl
        // $conn->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
        return $this->conns[$sourceId] = Connection::create($this->datasources[$sourceId]);
    }