-
-
Notifications
You must be signed in to change notification settings - Fork 454
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
Set doctrine.orm.entity_manager.abstract as lazy #559
Conversation
@@ -95,7 +95,7 @@ | |||
|
|||
<service id="doctrine.orm.configuration" class="%doctrine.orm.configuration.class%" abstract="true" public="false" /> | |||
|
|||
<service id="doctrine.orm.entity_manager.abstract" class="%doctrine.orm.entity_manager.class%" abstract="true" /> | |||
<service id="doctrine.orm.entity_manager.abstract" class="%doctrine.orm.entity_manager.class%" abstract="true" lazy="true" /> |
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.
You may want to set the attribute dynamically in the extension class depending on whether or not it is available.
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.
Any idea how you'd do that? This is purely an implementation detail that doesn't leak through the interfaces. Given that next versions are going to need this "lazy", adding the dynamic check would only be a micro optim for soon to be legacy versions. Worth it?
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.
You may want to set the attribute dynamically in the extension class depending on whether or not it is available.
"lazy" is simply no-op if the required components aren't installed.
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.
I agree with @nicolas-grekas and @Ocramius. there is no need to make it conditional as it is already handled gracefully.
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.
I am okay with that too if you then update the min version for the DependencyInjection component instead.
you need to change the DI min dependency from 2.2 to 2.3 to fix the deps=low tests |
@stof updated (line for DI added) |
Thanks @nicolas-grekas |
Hello, We are using lazy:true in services.yml. Looks like your change is disabling other services which has lazy=true; Strange. Half of a day I'm searching for a problem, but can't find, maybe you could find why that happens. Could be bug in dependency container? Test case: services.yml:
test:
class: Test
arguments: ['@doctrine.orm.default_entity_manager']
lazy: true
tags:
- { name: doctrine.event_listener, event: prePersist } test.php: class Test
{
public function __construct(EntityManager $em)
{
}
} composer.json:
"symfony/proxy-manager-bridge": "~2.3",
"ocramius/proxy-manager": "~1.0",
"symfony/symfony": "~2.8.9", |
@antanas-arvasevicius Could you repost in #559 for now. It may/may not be the same error, but for now it is nice to all the information in the same issue until we know more. |
Hello, what did you mean by repost in #559 as this thread is #559? By my example error is clearly known, it's due circular dependency of entity manager in listener service, and that's why I've had made that listener as a lazy service. |
Sorry i meant #562 |
Related to symfony/symfony#19203