src/mako/database/connections/Connection.php
protected function connect(): PDO
	{
		// Connect to the database

		try
		{
			$pdo = new PDO($this->dsn, $this->username, $this->password, $this->getConnectionOptions());
		}
		catch(PDOException $e)
		{
			throw new RuntimeException(vsprintf('Failed to connect to the [ %s ] database. %s', [$this->name, $e->getMessage()]));
		}

		// Run queries

		foreach($this->onConnectQueries as $query)
		{
			$pdo->exec($query);
		}

		// Return PDO instance

		return $pdo;
	}
protected function connect(): PDO
	{
		// Connect to the database

		try
		{
			$pdo = new PDO($this->dsn, $this->username, $this->password, $this->getConnectionOptions());
		}
		catch(PDOException $e)
		{
			throw new RuntimeException(vsprintf('Failed to connect to the [ %s ] database. %s', [$this->name, $e->getMessage()]));
		}

		// Run queries

		foreach($this->onConnectQueries as $query)
		{
			$pdo->exec($query);
		}

		// Return PDO instance

		return $pdo;
	}
protected function connect ( ) : PDO { // Connect to the database try { $ pdo = new PDO ( $ this -> dsn , $ this -> username , $ this -> password , $ this -> getConnectionOptions ( ) ) ; } catch ( PDOException $ e ) { throw new RuntimeException ( vsprintf ( 'Failed to connect to the [ %s ] database. %s' , [ $ this -> name , $ e -> getMessage ( ) ] ) ) ; } // Run queries foreach ( $ this -> onConnectQueries as $ query ) { $ pdo -> exec ( $ query ) ; } // Return PDO instance return $ pdo ; }
Creates a PDO instance.

@throws \RuntimeException
@return \PDO
Creates a PDO instance .