Exemple #1
0
 /**
  * Rad\Database\Connection constructor
  *
  * @param string $name
  * @param string $driver
  * @param array  $config
  */
 public function __construct($name, $driver, array $config)
 {
     $config = $config + ['host' => 'localhost', 'database' => 'rad', 'username' => 'root', 'password' => '', 'options' => []];
     $this->name = $name;
     $this->driver = DriverFactory::get($driver, $config);
 }
Exemple #2
0
 protected function getDriver($driver)
 {
     $factory = new DriverFactory();
     $driver = $factory->get($driver, $this->config);
     return $driver;
 }