Пример #1
0
 /**
  * @return void
  */
 public function connect()
 {
     if (null === $this->connection) {
         try {
             $this->connection = new Connection($this->config->getDsn(), $this->config->get('user'), $this->config->get('password'), $this->config->get('driver_options'));
             $this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
             $this->connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
         } catch (PDOException $e) {
             throw new RuntimeException($e->getMessage(), static::EXCEPTION_CODE, $e);
         }
     }
 }