Roots Discourse

Dependency injection in Controller - shared objects

I just installed Sage and started looking around. I found out I can pass my dependencies into the Controller constructor. That works fine, but I don’t see a way to configure the dependency as shared. For example, I have two Controllers, that have the same dependency (let’s say PostsFactory). When I pass it into the Controllers constructor, I end up with two different PostsFactory objects. Is there a way to configure the DI container. Also, is there a way to access the Container (or is there even a DI Container)?


This topic was automatically closed after 42 days. New replies are no longer allowed.