Advertisement
Guest User

DriverWithoutCache

a guest
Mar 7th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: richard
  5.  * Date: 3/7/17
  6.  * Time: 12:15 PM
  7.  *
  8.  * Usage (in config.yml):
  9.  * doctrine:
  10.  *   dbal:
  11.  *     driver_class: AppBundle\Service\DriverWithoutCache
  12.  */
  13.  
  14. namespace AppBundle\Service;
  15.  
  16.  
  17. use Doctrine\DBAL\DBALException;
  18. use Doctrine\DBAL\Driver\PDOException;
  19. use Doctrine\DBAL\Driver\PDOMySql\Driver;
  20.  
  21. class DriverWithoutCache extends Driver
  22. {
  23.     public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
  24.     {
  25.         try {
  26.             $conn = parent::connect($params, $username, $password, $driverOptions);
  27.             $conn->setAttribute(\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY,false);
  28.         } catch (PDOException $e) {
  29.             throw DBALException::driverException($this, $e);
  30.         }
  31.  
  32.         return $conn;
  33.     }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement