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

Allow specifying connection used by foundry #700

Open
BackEndTea opened this issue Oct 3, 2024 · 1 comment
Open

Allow specifying connection used by foundry #700

BackEndTea opened this issue Oct 3, 2024 · 1 comment

Comments

@BackEndTea
Copy link
Contributor

BackEndTea commented Oct 3, 2024

Currently its not possible to specify the connection that is used by foundry for the inserts.
This is a problem for me as the project i'm working on uses multiple connections, and the default connection may not have
insert rights for the entity i want to persist.

In the flow of the application the correct connection would be used for inserts, but this is not possible to configure for foundry.

Right now we can already specify the connection/entity manger to be used for resets: https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#database-reset

However we can't specify the connection that does the inserts. I would like something like

zenstruck_foundry:
   default_entity_manager: my_manager # defaults to doctrine.orm.default_entity_manager
@nikophil
Copy link
Member

nikophil commented Oct 4, 2024

Hi @BackEndTea

I'm not very familiar with working with multiple entity managers in the same app.

Correct me if I'm wrong: when working with several EM, can you have two EM which "manages" the same entity? In your case one is readonly (the default one), and the other one has write access?

I'd be OK for such a modification, but I'm trying to figure out if a default_entity_manager configuration is the best option 🤔
what if we have 2 databases, with each of them 2 EM, this would not work... Not sure if this is a common setup (I've never seen this in the wild), but I wouldn't want to be stuck if some day someone comes with such a problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants