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

Make it easier to set the connection used by the EventCollector #248

Open
jamisonbryant opened this issue Aug 30, 2024 · 2 comments
Open

Comments

@jamisonbryant
Copy link

jamisonbryant commented Aug 30, 2024

Hi there, still using Fixture Factories and loving it after nearly 2 years. I have a suggestion for a quality-of-life improvement.

I believe this would resolve some very tricky edge cases such as described in #187 and #233.

I noticed in EventCollector that the $options array only contains the two entries for "listening to model events" and "listening to behaviors" but there are many other options you can pass to the TableLocator, including connection.

Would it make sense to add a method to EventCollector called setConnection() that could be called like so:

$article = ArticleFactory::make()->setConnection('foo')->listeningToBehaviors('Sluggable')->getEntity();

I'd be happy to draft a PR for this, if you think this solution is a good idea. If there's a concern about the EventCollector being the wrong place for this, I could think of some other ideas.

@jamisonbryant
Copy link
Author

cc @dreamingmind - any thoughts on this? Asking because you and I are among the few engineers heavily using different DB connections with Fixture Factories 🤔

@pabloelcolombiano
Copy link
Collaborator

Hi @jamisonbryant ,

Thank you for the great idea. Yes feel free to send a PR with the necessary code coverage.

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

No branches or pull requests

2 participants