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

[1.x] Respect configuration changes #81

Merged
merged 2 commits into from
Jan 10, 2024
Merged

[1.x] Respect configuration changes #81

merged 2 commits into from
Jan 10, 2024

Conversation

timacdonald
Copy link
Member

fixes #80

Pennant's DatabaseDriver does not currently respect changes to configuration. It also holds onto a Illuminate\Database\Connection instance. This is problematic in Octane, queue worker, and testsuite scenarios.

This PR ensures that changes to configuration, such as Config::set('pennant.stores.database.connection', 'foo'), are respected. This most likely happens in testsuites when running in parallel.

It also stops the DatabaseDriver from holding on to a DB connection instance. The database manager is now injected and the connection is always resolved fresh.

This is technically a breaking change for anyone extending the DatabaseDriver as the __construct signature has changed and the injected $db type has changed. I think the likelihood of extending that is pretty slim and this is a worthwhile break to fix the bug.

@taylorotwell taylorotwell merged commit 92f892f into 1.x Jan 10, 2024
4 checks passed
@taylorotwell taylorotwell deleted the respect-config branch January 10, 2024 14:54
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

Successfully merging this pull request may close these issues.

Error when parallel testing with database driver
2 participants