Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Bridge/Doctrine] Reset the EM lazy-proxy instead of the EM service#19203
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| } | ||
| $manager->setProxyInitializer( | ||
| function (&$wrappedInstance,LazyLoadingInterface$manager)use ($name) { | ||
| $this->container->set($name,null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
this does not solve the issue, as it is what will be deprecated
stof commentedJun 28, 2016
Status: needs work |
nicolas-grekas commentedJun 28, 2016
Updated |
358a6bf to6bfdb82Compare| if (isset($this->aliases[$name =strtolower($name)])) { | ||
| $name =$this->aliases[$name]; | ||
| } | ||
| $method ='get'.strtr($name,$this->underscoreMap).'Service'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Isn't it possible instead to access the container methods map ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
BTW i guess we should somehow deprecate using another container than the one provided by symfony ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Method maps is now used also. We already are enforcing a symfony container, see type hint onContainerAwareTrait::setContainer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Of course but the type hint istargeting the interface, and we can't know its internals.
2efb9d2 to0315985Comparenicolas-grekas commentedJun 29, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Implementation details & discussion following @Ener-Getickcomments: the Yet, I think it's just fine to do direct access. Let's be pragmatic. |
stof commentedJun 29, 2016
@nicolas-grekas would be great to debug CI failures |
nicolas-grekas commentedJun 29, 2016
fabpot commentedJul 1, 2016
Thank you@nicolas-grekas. |
…he EM service (nicolas-grekas)This PR was merged into the 3.2-dev branch.Discussion----------[Bridge/Doctrine] Reset the EM lazy-proxy instead of the EM service| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | yes| Tests pass? | no| Fixed tickets | -| License | MIT| Doc PR | -This makes the entity manager resettable by resetting its proxy, which should be more robust than resetting its service.See first comments in#19192Ping@stofCommits-------c581cd4 [Bridge/Doctrine] Reset the EM lazy-proxy instead of the EM service
stof commentedJul 13, 2016
@nicolas-grekas you forgot the second half of this task: opening a PR on DoctrineBundle to mark the EM services as lazy so that a proxy is generated for them. |
gregoirepaqueron commentedApr 13, 2017
How to set entity managers lazy by default doctrine configuration ? My conf : doctrine:orm:auto_generate_proxy_classes:"%kernel.debug%"default_entity_manager:defaultentity_managers:sso:connection:ssomappings:GsoiJNumAdminMainBundle:type:"annotation"dir:"Entity/SSO"prefix:"MyPrefix\\Entity\\SSO" When i want to reset the manager, i got the deprecation message : with this code : $this->container->get('doctrine')->resetManager('sso'); |
stof commentedApr 13, 2017
install |
gregoirepaqueron commentedApr 13, 2017
Thank you@stof for your explanation! |
Uh oh!
There was an error while loading.Please reload this page.
This makes the entity manager resettable by resetting its proxy, which should be more robust than resetting its service.
See first comments in#19192
Ping@stof