PHP code example of arntech / doctrine-timeout-handler
1. Go to this page and download the library: Download arntech/doctrine-timeout-handler 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/ */
arntech / doctrine-timeout-handler example snippets
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\DriverManager;
$config = new Configuration();
$connectionParams = array(
'dbname' => 'mydb',
'user' => 'user',
'password' => 'secret',
'host' => 'localhost',
// [doctrine-mysql-come-back] settings
'wrapperClass' => 'ARNTech\DoctrineTimeout\Connection',
'driverClass' => 'ARNTech\DoctrineTimeout\Driver\PDOMySql\Driver',
'driverOptions' => array(
'x_reconnect_attempts' => 3,
'check_connection_beforehand' => true //this specifies to check if connection is still alive before executing anything
)
);
$conn = DriverManager::getConnection($connectionParams, $config);