Skip to content

DriverManager::getConnection does not accept an existing PDO object as a configuration option. #4504

Closed
@rhift

Description

@rhift

Bug Report

Q A
BC Break ?
Version 3.0.0

Summary

\Doctrine\DBAL\DriverManager::getConnection does not accept an existing PDO object as a configuration option.

I'm not sure if this support was removed in 3.0.0 or if this is a bug. I'm really hoping it's a bug since I won't be able to use 3.0.0 in the case that it's not supported. =)

I think it's a bug since the 3.0.0 documentation is the same API as the 2.x series (or I guess it could be a documentation c&p issue).

Thank you!

Current behaviour

When using

DriverManager::getConnection(['pdo' => new \PDO(/* constructor options */)]);

\Doctrine\DBAL\Exception is thrown with the message "The options 'driver' or 'driverClass' are mandatory if no PDO instance is given to DriverManager::getConnection().".

How to reproduce

Execute

DriverManager::getConnection(['pdo' => new \PDO(/* constructor options */)]);

Notice that \Doctrine\DBAL\Exception is thrown with the message "The options 'driver' or 'driverClass' are mandatory if no PDO instance is given to DriverManager::getConnection().".

Expected behaviour

No Throwable is thrown and DriverManager::getConnection returns a viable connection. (i.e. it works as it does in 2.12.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions