PHP code example of bit3 / contao-doctrine-dbal-driver

1. Go to this page and download the library: Download bit3/contao-doctrine-dbal-driver library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bit3 / contao-doctrine-dbal-driver example snippets


$GLOBALS['TL_CONFIG']['dbDriver'] = 'DoctrineMySQL';

class MyClass
{
	public function myFunc()
	{
		global $container;
		/** @var \Doctrine\DBAL\Connection $connection */
		$connection = $container['doctrine.connection.default'];

		$connection->query('...');
	}
}

class MyClass
{
	public function myFunc()
	{
		/** @var \Doctrine\DBAL\Connection $connection */
		$connection = Database::getInstance()->getConnection();
	}
}