Unverified Commit bc101552 authored by Kim Hemsø Rasmussen's avatar Kim Hemsø Rasmussen Committed by Marco Pivetta

Set platform instance if passed in connection params and remove it from there.

parent 9d1edb72
......@@ -211,6 +211,15 @@ class Connection implements DriverConnection
unset($this->_params['pdo']);
}
if (isset($params["platform"])) {
if ( ! $params['platform'] instanceof Platforms\AbstractPlatform) {
throw DBALException::invalidPlatformSpecified();
}
$this->platform = $params["platform"];
unset($this->_params["platform"]);
}
// Create default config and event manager if none given
if ( ! $config) {
$config = new Configuration();
......@@ -384,7 +393,6 @@ class Connection implements DriverConnection
*/
private function detectDatabasePlatform()
{
if ( ! isset($this->_params['platform'])) {
$version = $this->getDatabasePlatformVersion();
if (null !== $version) {
......@@ -392,11 +400,6 @@ class Connection implements DriverConnection
} else {
$this->platform = $this->_driver->getDatabasePlatform();
}
} elseif ($this->_params['platform'] instanceof Platforms\AbstractPlatform) {
$this->platform = $this->_params['platform'];
} else {
throw DBALException::invalidPlatformSpecified();
}
$this->platform->setEventManager($this->_eventManager);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment