Exemple #1
0
 /**
  * @return AdapterAbstract
  * @throws \Exception
  */
 public function getAdapter()
 {
     if (!is_null($this->adapter)) {
         return $this->adapter;
     }
     $adapterClassName = "DbEasy\\Adapter\\" . ucfirst($this->dsn->getScheme());
     if (class_exists($adapterClassName)) {
         $this->adapter = new $adapterClassName();
         $this->adapter->setDsn($this->dsn);
         $this->placeholders->setQuotePerformer($this->adapter);
         return $this->adapter;
     }
     throw new \Exception('Not found adapter for database: ' . $this->dsn->getScheme());
 }