acolono / opencounter_api

0 stars 0 forks source link

container aware controller or not #20

Closed rosenstrauch closed 7 years ago

rosenstrauch commented 8 years ago

turns out slim controllers are container aware, this means that their dependencies are hidden, and i am inclined to use the service locator anti-pattern for accessing my dependencies.

I dont want to pass the container as first argument to my controllers but use inflection (or reflection or whatever) to tell my container which dependencies to construct my controller with instead of asking the container for services.

according to slim docs it will look for a controller in the container before instantiating it, so i should be able to explicitly register the controller as a service with the dependencies it typehints via interfaces and it wont try instanciating it vith the container as first argument.