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

[Lock][Cache] Allows URL DSN in PDO adapters #34057

Merged
merged 1 commit into from Oct 29, 2019

Conversation

jderusse
Copy link
Member

Q A
Branch? 4.4
Bug fix? no
New feature? yes
Deprecations? no
Tickets -
License MIT
Doc PR TODO

This PR duplicate a feature from PdoSessionHandler that convert URL DSN ( ie. mysql://localhost/test) into PDO DSN (ie. mysql:host=localhost;dbname=test)

that would ease configuration by using the same well-known variable

framework:
  lock: '%env(DATABASE_URL)%'

note: I applied the same change on Cache component for consistency.

@jderusse jderusse force-pushed the pdo-dsn branch 2 times, most recently from b184b31 to dfd3ef3 Compare October 22, 2019 06:52
@jderusse jderusse changed the title Allows URL DSN in Lock and Cache [Lock][Cache] Allows URL DSN in PDO adapters Oct 22, 2019
@nicolas-grekas nicolas-grekas added this to the next milestone Oct 22, 2019
@nicolas-grekas
Copy link
Member

I would rather go with supporting those DSNs only when Dbal is found, to reuse the similar logic they have AFAIK. Doable?

@jderusse jderusse force-pushed the pdo-dsn branch 3 times, most recently from 8d2d79f to 8b94126 Compare October 22, 2019 09:56
@jderusse
Copy link
Member Author

@nicolas-grekas done

@stof
Copy link
Member

stof commented Oct 22, 2019

I would rather go with supporting those DSNs only when Dbal is found, to reuse the similar logic they have AFAIK. Doable?

That's less powerful than in other components (and makes these PDO-based implementation unusable on Heroku or Symfony Cloud without installing DBAL)

@nicolas-grekas
Copy link
Member

That's less powerful than in other components

You mean PdoSessionHandler, are there more examples?
The requirement is really low here (using dbal, which is a better PDO) and the alternative too is ok (using a PDO DSN).
To me, the less code we maintain the better.

@stof
Copy link
Member

stof commented Oct 22, 2019

the alternative too is ok (using a PDO DSN).

that's exactly what is not possible when the env variable is managed by the PaaS hosting.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Oct 22, 2019

that's exactly what is not possible when the env variable is managed by the PaaS hosting.

well, then use dbal - we don't have to solve unreported problems.

@jderusse jderusse force-pushed the pdo-dsn branch 2 times, most recently from 3f4ff8f to 4167037 Compare October 22, 2019 19:26
@nicolas-grekas
Copy link
Member

Thank you @jderusse.

nicolas-grekas added a commit that referenced this pull request Oct 29, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

[Lock][Cache] Allows URL DSN in PDO adapters

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | TODO

This PR duplicate a feature from PdoSessionHandler that convert URL DSN ( ie. mysql://localhost/test) into PDO DSN (ie. mysql:host=localhost;dbname=test)

that would ease configuration by using the same well-known variable
```
framework:
  lock: '%env(DATABASE_URL)%'
```

note: I applied the same change on Cache component for consistency.

Commits
-------

474daf9 Allows URL DSN in Lock and Cache
@nicolas-grekas nicolas-grekas merged commit 474daf9 into symfony:4.4 Oct 29, 2019
This was referenced Nov 12, 2019
@jderusse jderusse deleted the pdo-dsn branch March 5, 2020 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants