-
Notifications
You must be signed in to change notification settings - Fork 66
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
Multiple entity managers #342
Comments
I personally have never tried this bundle with multiple entity managers, but I think it should work well. The error is from your code, right? I mean, this In short, just compare ResetPasswordRequestRepository's |
It is exactly like the other repositories, this is the only one I get the error. This is how I have the repo. I believe the issue lies on the autowire of the ResetPasswordRequestRepositoryInterface on some files like ResetPasswordHelper.php. According to the multiple entity manager documentation, when we extend EntityRepository, we should not use autowire. But I need to extend EntityRepository for all, otherwise I can't work with multiple tenants. |
If so, then it's a problem because as I see the repo is injected in |
Yes, it can be a solution, but it has to be configurable, we have to be able to configure the entity manager we want otherwise it will always get the default one. |
Thanks for confirming. In this case, it seems this bundle is not ready to work with multiple entity managers. If you have any ideas on how to fix it - please, feel free to create a PR |
I'll look into this. Should be possible but the bundle could be coded in a way that doesn't allow it. Basically, it should be using the manager registry to fetch repositories by entity. |
@silvandre95 first thing: you're repository isn't a service. That's what's causing the error. Can you have it extend ServiceEntityManager like shown here: https://github.com/SymfonyCasts/reset-password-bundle/blob/main/tests/Fixtures/App/src/Repository/ResetPasswordRequestRepository.php (you'll need to override the constructor like in this file but with your entity class) |
@kbond if I extend the ServiceEntityRepository, I'll never be able to use this repo with my multi tenant implementation. |
Ahh, I misunderstood your multi-entity manager usage. I think what you'll need to do is create your own |
Hello, I'm currently working with multiple entity managers and when I extend EntityRepository on my ResetPasswordRequestRepository, I get this error:
I know that when extending from EntityRepository we cannot rely on autowire, is this bundle prepared to work with multiple entity managers?
The text was updated successfully, but these errors were encountered: