I want to access a service I've created (ServiceClass) from another class that I've created (ClassA). I've read a lot that the proper way to do this is to make ClassA a service and then inject ServiceClass, but class ClassA is not really a service in terms of functionality, it doesn't provide any global functionality, for me it's an Entity, so making it a service just so I can have access to other services doesn't seem right. Can anyone help me understand?
1 Answer
If it is an entity than it shouldn't need to know about any service. In ideal cases entities are just used to store data. You should rethink your class structure probably.
If you still want to go that way anyway, your only option is to declare it as a service or inject/set services when instantiating your class.
And yes, please provide code so we can suggest you what to do. This is just blind guessing because you provided very little info.