28 private $mysqlFactory;
40 $this->connectionConfig = $this->getValidConfig(
$config);
42 parent::__construct();
53 if ($profiler instanceof DB\
Profiler) {
54 $profiler->setType($this->connectionConfig[
'type']);
55 $profiler->setHost($this->connectionConfig[
'host']);
70 return $this->mysqlFactory->create(
72 $this->connectionConfig,
85 return DB\Adapter\Pdo\Mysql::class;
94 private function getValidConfig(array
$config)
96 $default = [
'initStatements' =>
'SET NAMES utf8',
'type' =>
'pdo_mysql',
'active' =>
false];
97 foreach ($default as $key =>
$value) {
105 throw new \InvalidArgumentException(
"MySQL adapter: Missing required configuration option '$name'");
110 throw new \InvalidArgumentException(
111 "Port must be configured within host (like '$config[host]:$config[port]') parameter, not within port" getDbConnectionClassName()
getDbConnectionInstance(DB\LoggerInterface $logger=null, SelectFactory $selectFactory=null)
__construct(array $config, MysqlFactory $mysqlFactory=null)
getConnection(DB\LoggerInterface $logger=null, SelectFactory $selectFactory=null)
if(!isset($_GET['name'])) $name