-
Notifications
You must be signed in to change notification settings - Fork 453
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
Service with dependency to fos_oauth_server.client_manager connects to database #422
Comments
fos_oauth_server.client_manager
connects to database…the fly, not in the constructor anymore This avoids a database connection to be established for every request Fixes issue FriendsOfSymfony#422
This is a serious issue. There is a connection established to the oauth database for every request processed by the Symfony framework as soon as FOSOAuthServerBundle is configured and there is a "fos_oauth: true" somewhere in the app/config/security.yml configuration file. If one has a big website with only a small part of it protected by OAuth, this is a waste of resources. The problem comes from Entity/ClientManager and Entity/TokenManager which instantiate a repository in their constructor. lazy=true does not appear as an ideal solution to me, because it relies on ocramius/proxy-manager to be installed. Here is my attempt to address this issue : #440 |
…t the repository instanciated in the entity constructors (see issue FriendsOfSymfony#422)
…the fly, not in the constructor anymore This avoids a database connection to be established for every request Fixes issue FriendsOfSymfony#422
…t the repository instanciated in the entity constructors (see issue FriendsOfSymfony#422)
…the fly, not in the constructor anymore This avoids a database connection to be established for every request Fixes issue FriendsOfSymfony#422
This avoids a database connection to be established for every request Fixes issue FriendsOfSymfony#422
This avoids a database connection to be established for every request Fixes issue FriendsOfSymfony#422
This avoids a database connection to be established for every request Completes fix for issue FriendsOfSymfony#422
When having a service with a dependency to
fos_oauth_server.client_manager
, the connection to the database is established. I worked around it be marking thefos_oauth_server.client_manager
lazy=true
.If that's a valid solution to you, I will send a PR, otherwise please tell me what to do?
The text was updated successfully, but these errors were encountered: