Gets the wrapped driver connection.
public getWrappedConnection ( ) : Doctrine\DBAL\Driver\Connection | ||
return | Doctrine\DBAL\Driver\Connection |
use Doctrine\DBAL\DriverManager; $connection = DriverManager::getConnection(array( 'dbname' => 'mydatabase', 'user' => 'myusername', 'password' => 'mypassword', 'host' => 'localhost', 'driver' => 'pdo_mysql', )); $wrappedConn = $connection->getWrappedConnection();
use Doctrine\DBAL\Driver\PDOConnection; $pdo = new PDO('mysql:dbname=mydatabase;host=127.0.0.1', 'myuser', 'mypassword'); $pdoConn = new PDOConnection($pdo); $connection = new Doctrine\DBAL\Connection(array(), $pdoConn); $wrappedConn = $connection->getWrappedConnection();In this example, we manually create an instance of PDOConnection using a PDO object, and then pass it to the Doctrine DBAL Connection instance. After that, we can get the underlying PDO connection using getWrappedConnection(). The package library for this example is also Doctrine DBAL.
public getWrappedConnection ( ) : Doctrine\DBAL\Driver\Connection | ||
return | Doctrine\DBAL\Driver\Connection |