Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 2.8.9 |
I have a repository that needs to be constructed as a service because it depends on an another service that deals with external communications. The repo is defined as a lazy service to avoid issues with db connection.
So the service is defined like this:
service1:
class: ClassRepository
factory: ['@doctrine.orm.default_entity_manager', getRepository]
arguments:
- Class
calls:
- ["setService", "@service2"]
lazy: true
tags:
- name: doctrine.repository
This being a doctrine repository, I had to do a new implementation of the Repository factory to look on the container if the service is in a whitelist of repositories that we have defined as services.
The issue seems to be that the code $wrappedInstance inside the generated code seems to point to itself after initializing the value, so the php code dies out when the maximum nesting level is met.
Is this kind of use case supported? I had to add some if's to break the infinite loop but it's not something i feel very comfortable with.