[critical] Services load before repositories definition
Nek- opened this issue · comments
Maxime Veber commented
The following line of code load every services (except scoped services or tagged services). So you can't use repository services for your basicals services.
https://github.com/KnpLabs/KnpRadBundle/blob/develop/DependencyInjection/Compiler/RegisterDoctrineRepositoriesPass.php#L33
You also can't define repositories as service by yourself because you get a circular reference of services.
Florian Klein commented
can you provide an example please ?
So i'll be able to define this use case in behat suite, and avoid any regression.
Florian Klein commented
thanks BTW :)
Maxime Veber commented
Here is an example:
app.parameter.provider:
class: App\Provider\ParameterProvider
arguments:
- @app.entity.parameter_repository
app.mailer.template.loader:
class: App\Mailer\TemplateLoader
arguments: [ @app.parameter.provider ]
calls:
- [setContainer, ['@service_container']]