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

Deprecation warning #41

Closed
stevenbrookes opened this issue Oct 29, 2020 · 6 comments
Closed

Deprecation warning #41

stevenbrookes opened this issue Oct 29, 2020 · 6 comments

Comments

@stevenbrookes
Copy link

Hi

Thanks for this library - it's been working very well for us. I'm seeing this deprecation warning in our Symfony project

The "Doctrine\DBAL\Connection::__construct()" method is considered internal The connection can be only instantiated by the driver manager. It may change without further notice. You should not extend it from "Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Connection".

This is with doctrine/dbal 2.12.0. I imagine this isn't a real problem yet, but annoying as this gets flagged up as part of our build process. Is there a way to achieve what this library does without overriding the constructor? Or perhaps a way to turn off the warning at least.

Regards

Steve

@Jean85
Copy link
Member

Jean85 commented Oct 30, 2020

We could try to use a decorator pattern instead of extension, but I'm not sure if everything that we need to accomplish is doable in that way...

@Jean85
Copy link
Member

Jean85 commented Oct 30, 2020

Umh, this seems counter-intuitive, but avoiding extending Doctrine\DBAL\Connection is NOT doable, you get this error:

Doctrine\DBAL\Exception: The given 'wrapperClass' Facile\DoctrineMySQLComeBack\Doctrine\DBAL\FunctionalTest\Connection has to be a subtype of \Doctrine\DBAL\Connection.

vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:221
vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php:195
...

@stevenbrookes
Copy link
Author

Yeah that does seem odd, if the only way to wrap is by extending then either the deprecation message is incorrect or doctrine needs to provide another way to wrap the connection. I suspect we might have to live with the warning for a while until this is resolved by doctrine and an way forward becomes apparent.

@thomasvargiu
Copy link
Member

The deprecation warning seems to come from Symfony's DebugClassLoader.

I think the only way is to disable E_USER_DEPRECATED errors in production, but it seems not possible to remove them completely.

@mathop
Copy link

mathop commented Nov 25, 2020

Another important deprecation to consider:

\Doctrine\DBAL\Driver\PDOMySql\Driver is deprecated in favor of \Doctrine\DBAL\Driver\PDO\MySQL\Driver, which is final.

doctrine/dbal#4144

@Jean85
Copy link
Member

Jean85 commented Apr 1, 2023

Closing as everything is now correctly handled in 2.0.
Unfortunately, I don't have the bandwidth to fix the deprecations in 1.x, and I'm not even sure those are fixable.

@Jean85 Jean85 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants