Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too generic DBALException when using existing PDO #3648

Closed
Erikvv opened this issue Aug 9, 2019 · 4 comments
Closed

Too generic DBALException when using existing PDO #3648

Erikvv opened this issue Aug 9, 2019 · 4 comments

Comments

@Erikvv
Copy link

Erikvv commented Aug 9, 2019

Bug Report

Q A
BC Break no
Version 2.9.2

Summary

Instead of a specific exception like Doctrine\DBAL\Exception\InvalidFieldNameException or Doctrine\DBAL\Exception\UniqueConstraintViolationException there is a Doctrine\DBAL\DBALException when using an existing PDO instance.

How to reproduce

Check out https://github.com/Erikvv/doctrine-vs-pdo/tree/unique-exception
-> use the correct branch
-> xdebug is provided for your convenience

This compares 2 databases using existing PDO vs letting Doctrine create it.

Run:

$ docker-compose run php

Expected:

Doctrine\DBAL\Exception\UniqueConstraintViolationException
Doctrine\DBAL\Exception\UniqueConstraintViolationException

Actual:

Doctrine\DBAL\DBALException
Doctrine\DBAL\Exception\UniqueConstraintViolationException

Notes

On develop branch reusing PDO fails entirely with a nonsensical exception

Fatal error: Uncaught Doctrine\DBAL\Exception\DriverRequired: The options "driver" or "driverClass" are mandatory if no PDO instance is given to DriverManager::getConnection(). in /usr/src/doctrine-vs-pdo/vendor/doctril/lib/Doctrine/DBAL/Exception/DriverRequired.php on line 27

@Erikvv Erikvv changed the title Generic DBALException when using existing PDO Too generic DBALException when using existing PDO Aug 9, 2019
@Erikvv
Copy link
Author

Erikvv commented Aug 10, 2019

I just saw in previous discussions that this is no longer a scenario the maintainers want to support.

@matriphe
Copy link

@Erikvv could you point me the link of the discussion? I had similar problem and came across to this issue. thanks!

@Erikvv
Copy link
Author

Erikvv commented Aug 12, 2019

@matriphe #3548

I guess I'll close this issue then.

@Erikvv Erikvv closed this as completed Aug 12, 2019
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants