-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] Using DSN with PDOAdapter #52460
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
Labels
Comments
Looks like a feature request indeed, there's nothing in the code that could make this work currently. |
And this should be reported as a bug in https://github.com/symfony/symfony-docs/ as it documents something that does not exist. |
Thanks guys, I'll open a PR in the docs repo. |
OskarStark
added a commit
to symfony/symfony-docs
that referenced
this issue
Nov 7, 2023
This PR was merged into the 5.4 branch. Discussion ---------- [Cache] Fix PdoAdapter examples As mentioned in symfony/symfony#52460, using a DSN with the PdoAdapter is currently not supported, instead a service name should be provided, eg: ```yaml app.my_pdo_service: class: \PDO arguments: - 'pgsql:host=localhost' ``` I haven't included the actual service definition since `app.my_psr6_service` isn't included either, but if you think I should, please let me know. Commits ------- 7ab6c81 [Cache] Fix PdoAdapter examples
fabpot
added a commit
that referenced
this issue
Jan 12, 2024
…ypeMC) This PR was merged into the 7.1 branch. Discussion ---------- [Cache] Add support for using DSN with `PDOAdapter` | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | Fix #52460 | License | MIT Adds support for using DSN with the `PDOAdapter`: ```yaml framework: cache: pools: my.cache: adapter: cache.adapter.pdo provider: "pgsql:host=localhost;port=5432;dbname=postgres;user=postgres;password=pass" ``` Commits ------- 75984c2 [Cache] Add support for using DSN with PDOAdapter
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Symfony version(s) affected
>=5.4
Description
According to the docs it should be possible to use DSN to configure the PDOAdapter, how an exception is thrown instead:
This happens because the
AbstractAdapter::createConnection()
supports only certain adapters:symfony/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php
Lines 127 to 144 in 58353d1
I'm not sure if this is a bug in the documentation (and possible new feature) or a bug in the code.
How to reproduce
Possible Solution
Add the necessary logic to
AbstractAdapter::createConnection()
.Additional Context
No response
The text was updated successfully, but these errors were encountered: