Example #1
0
 /**
  * Initializes a new instance of the Connection class.
  *
  * @param array $params  The connection parameters.
  * @param Driver $driver
  * @param Configuration $config
  * @param EventManager $eventManager
  */
 public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null)
 {
     $this->_driver = $driver;
     $this->_params = $params;
     if (isset($params['pdo'])) {
         $this->_conn = $params['pdo'];
         $this->_isConnected = true;
     }
     // Create default config and event manager if none given
     if (!$config) {
         $config = new Configuration();
     }
     if (!$eventManager) {
         $eventManager = new EventManager();
     }
     $this->_config = $config;
     $this->_eventManager = $eventManager;
     $this->_platform = $driver->getDatabasePlatform();
     $this->_transactionIsolationLevel = $this->_platform->getDefaultTransactionIsolationLevel();
     $this->_quoteIdentifiers = $config->getQuoteIdentifiers();
     $this->_platform->setQuoteIdentifiers($this->_quoteIdentifiers);
 }