/** * @inheritdoc */ public function getMapper($type = null) { $dbConfig = $this->config->getDatabase(); if (is_null($type)) { $type = $dbConfig['default']; } if ($this->mappers[$type] instanceof Mapper) { return $this->mappers[$type]; } if (isset($dbConfig['connections'][$type]['mapper'])) { $mapperClass = $dbConfig['connections'][$type]['mapper']; } elseif (isset($dbConfig['connections'][$type]) && $type === 'mysql') { $mapperClass = $this->mappers['mysql']; } else { throw new \LogicException('Database Mapper not provided'); } if ($mapperClass instanceof Mapper) { return $mapperClass; } return $this->mappers[$type] = new $mapperClass($dbConfig['connections'][$type]); }
/** * @param Config $config */ public function loadOptions(Config $config) { $options = array_merge($this->options, $config->get('options', [])); $this->loader($options, 'options'); }