Commit bddcb16e authored by David Zuelke's avatar David Zuelke

support dashes in schemes for db drivers, translated to underscores

parent fbc96155
...@@ -238,6 +238,7 @@ final class DriverManager ...@@ -238,6 +238,7 @@ final class DriverManager
} }
if (isset($url['scheme'])) { if (isset($url['scheme'])) {
$url['scheme'] = str_replace('-', '_', $url['scheme']); // URL schemes must not contain underscores, but dashes are ok
if (isset(self::$_driverSchemeAliases[$url['scheme']])) { if (isset(self::$_driverSchemeAliases[$url['scheme']])) {
$params['driver'] = self::$_driverSchemeAliases[$url['scheme']]; // use alias $params['driver'] = self::$_driverSchemeAliases[$url['scheme']]; // use alias
} else { } else {
......
...@@ -199,6 +199,10 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase ...@@ -199,6 +199,10 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
'drizzle_pdo_mysql://foo:bar@localhost/baz', 'drizzle_pdo_mysql://foo:bar@localhost/baz',
false, false,
), ),
'simple URL with fallthrough scheme containing dashes works' => array(
'drizzle-pdo-mysql://foo:bar@localhost/baz',
array('user' => 'foo', 'password' => 'bar', 'host' => 'localhost', 'dbname' => 'baz', 'driver' => 'Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver'),
),
); );
} }
} }
\ No newline at end of file
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