Closed rivetchip closed 9 years ago
May be worth looking at, but it has to be resolved into a callable before any middleware can be added on top. So not sure if this is possible. Also we are not just talking about controllers, middleware also needs to use the same resolver.
Hello, this is done in a pr https://github.com/slimphp/Slim/pull/1208
@lalop Thanks I haven't seen it, I'll look in more deeply.
For each mapped route using a "string controller", Slim create a new instance of
CallableResolver
.Isn't it more performance and better to resolve the callable directly into Route::__invoke() ? So only the one and final instance will be created. Something like :
But it also have a counterparty : passing Slim's Container to Route ( because of
ResolveCallable
Trait and$this
) or removingprotected $container
ofCallableResolver
( don't think it's really useful unless we want to register a controller ). What do you guys thinking ?