-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Standalone DSN parser #5843
Merged
Merged
Standalone DSN parser #5843
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
derrabus
force-pushed
the
feature/dsn-parser
branch
from
December 30, 2022 10:54
9589583
to
ee8c0c3
Compare
Closed
derrabus
force-pushed
the
feature/dsn-parser
branch
from
December 30, 2022 13:22
ee8c0c3
to
856f6e9
Compare
derrabus
force-pushed
the
feature/dsn-parser
branch
from
December 30, 2022 13:45
856f6e9
to
113fb84
Compare
derrabus
changed the title
Extract DSN parsing into a dedicated class
Standalone DSN parser
Dec 30, 2022
derrabus
force-pushed
the
feature/dsn-parser
branch
from
December 30, 2022 15:22
113fb84
to
1028797
Compare
greg0ire
reviewed
Dec 30, 2022
derrabus
force-pushed
the
feature/dsn-parser
branch
from
December 30, 2022 19:08
f0977ae
to
d380886
Compare
greg0ire
approved these changes
Dec 30, 2022
This was referenced Dec 31, 2022
How to pass driver options now ? Earlier it used to be $connection = DriverManager::getConnection([
'url' => $this->databaseUrl,
'driverOptions' => $driverOptions,
'defaultTableOptions' => [
'charset' => 'utf8mb4',
'collate' => 'utf8mb4_0900_ai_ci',
],
]); Now it is $dsnParser = new DsnParser(['mysql' => 'pdo_mysql']);
$connection = DriverManager::getConnection(
$dsnParser->parse('mysql://my-user:t0ps3cr3t@my-host/my-database'),
// how to pass driverOptions, defaultTableOptions etc ?
); |
Merge them into the array that the parser returns before passing it to the driver manager. |
Oh my bad, parser returns array 😂 ... didn't notice it |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
See the linked issue for details and motivation.
This PR extracts the parsing of the
url
config param into a dedicated class. This allows to configure how we map URL schemes to DBAL drivers before we parse a database URL. The idea is thatDriverManager
becomes unaware of database URLs entirely, giving the app full control over:This also obsoletes the deprecation introduced by #5697: Once
DriverManager
does not parse database URLs anymore, the mapping from schemes to drivers becomes a userland concern or a concern of the integration layer (e.g. DoctrineBundle).