Set name of service for inject method
- Keeehi
- Member | 36
Hi,
My base presenter injects (by inject* method) some service. The problem is that there are two services created from the same class. The services have names, so i can say in config.neon which should be used but:
- Base presenter is abstract, so service can't be created from it and I have no idea where else I could configure that.
- Even if I could create a service, I don't know how to specify name of service for inject* method. I only know, how to do it in constructor (@service.name)
Workaround for now is that I have to create services in config.neon for all presenters (sooo unnecessary) and specify it in constructors. But because of this one, I have to specify all parameters of all presenters constructors and it is soooo ugly.
So, is there a nice way how to do it that I don't know?
Thanks
- Keeehi
- Member | 36
Thanks, that was exactly what I was looking for.
Just one more question. Is it safe to use for a name of the method something that starts with inject? I don't want it to be called twice (once for automatic injection and once for decorator). I run it in debugger and it was called once and with right service, so it works now. I just want to know if the naming could cause some problems in the future.