Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
DBAL 4 compatibility #1707
DBAL 4 compatibility #1707
Changes from all commits
76707f6
293fe8f
ddacc79
ad85762
843e348
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so previously this skipped any server version and for mysql for example just returned
MySQLPlatform
.We could use
$connection->getDatabasePlatform()
but it would mean we auto-detect the server version which could mean we actually connect to the database. We should avoid that here I guess.Is there any other way to do this with DBAL 4 except for using a
StaticServerVersionProvider
with a fallback to an empty server version? 🙈 🤔@derrabus maybe you have an idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why though? For MySQL drivers especially, this sounds like a bad idea because we need the server version to determine whether we talk to a MySQL or a MariaDB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We check if its a "Mysql like" platform (
AbstractMySQLPlatform
) to set thecollation
option 🤔See
DoctrineBundle/ConnectionFactory.php
Lines 105 to 127 in b1ff934
Maybe this isn't even needed anymore on DBAL 4? See doctrine/dbal#5214, doctrine/dbal#5246
I believe
AbstractMySQLPlatform
only handlescollation
on 4.0, or?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm but we also set a default charset
utf8mb4
for those platforms 🤔 We have to keep this I think?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not using
$connection->getDatabasePlatform()
instead, which would automatically use the version provider based on the configuration ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or better, using
$this->getDatabasePlatform()
to have the better error message telling you how to do if you want to be able to instantiate the connection in environments not able to connect yet.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this but it would mean we might connect to the database to determine the platform version (if not specified via config). For example all over the testsuite we would try to connect to some mysql db.
Since this is the initial connection that is replaced further down with changed parameters: we should avoid connecting, or?