protected function setDb($dbType = 'mysql')
{
$config = $this->config;
if ($this->di->has('db')) {
$db = $this->di->get('db');
$class = 'Phalcon\\Db\\Adapter\\Pdo\\' . ucfirst($dbType);
if (get_class($db) == $class) {
return $db;
}
}
// Set the connection to whatever we chose
$this->di->set('db', function () use($dbType, $config) {
$params = $config['db'][$dbType];
$class = 'Phalcon\\Db\\Adapter\\Pdo\\' . ucfirst($dbType);
$conn = new $class($params);
return $conn;
});
}