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

Service with dependency to fos_oauth_server.client_manager connects to database #422

Open
havvg opened this issue Jul 20, 2016 · 1 comment

Comments

@havvg
Copy link

havvg commented Jul 20, 2016

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 the fos_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?

@havvg havvg changed the title Service with dependency to fos_oauth_server.client_manager connects to database Service with dependency to fos_oauth_server.client_manager connects to database Jul 20, 2016
abienvenu added a commit to abienvenu/FOSOAuthServerBundle that referenced this issue Nov 18, 2016
…the fly, not in the constructor anymore

This avoids a database connection to be established for every request

Fixes issue FriendsOfSymfony#422
@abienvenu
Copy link

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

abienvenu added a commit to abienvenu/FOSOAuthServerBundle that referenced this issue Jan 6, 2017
…t the repository instanciated in the entity constructors (see issue FriendsOfSymfony#422)
abienvenu added a commit to abienvenu/FOSOAuthServerBundle that referenced this issue Jan 31, 2018
…the fly, not in the constructor anymore

This avoids a database connection to be established for every request

Fixes issue FriendsOfSymfony#422
abienvenu added a commit to abienvenu/FOSOAuthServerBundle that referenced this issue Jan 31, 2018
…t the repository instanciated in the entity constructors (see issue FriendsOfSymfony#422)
abienvenu added a commit to abienvenu/FOSOAuthServerBundle that referenced this issue Jan 31, 2018
…the fly, not in the constructor anymore

This avoids a database connection to be established for every request

Fixes issue FriendsOfSymfony#422
abienvenu added a commit to abienvenu/FOSOAuthServerBundle that referenced this issue Jan 31, 2018
This avoids a database connection to be established for every request
Fixes issue FriendsOfSymfony#422
abienvenu added a commit to abienvenu/FOSOAuthServerBundle that referenced this issue Feb 1, 2018
This avoids a database connection to be established for every request
Fixes issue FriendsOfSymfony#422
abienvenu added a commit to abienvenu/FOSOAuthServerBundle that referenced this issue Feb 2, 2018
This avoids a database connection to be established for every request
Completes fix for issue FriendsOfSymfony#422
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