You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an issue about route parameters and Dependency Injection usign PHP-DI.
<?php
namespace Application\Resolvers;
use DI\Container;
use Phroute\Phroute\HandlerResolverInterface;
class RouterResolver implements HandlerResolverInterface
{
private $container;
public function __construct(Container $container)
{
$this->container = $container;
}
public function resolve($handler, /* ¿¿$vars?? */)
{
/*
* Only attempt resolve uninstantiated objects which will be in the form:
*
* $handler = ['App\Controllers\Home', 'method'];
*/
if(is_array($handler) and is_string($handler[0])) {
$handler[0] = $this->container->call($handler, /* ¿¿$vars?? */);
}
return $handler;
}
}
It is because the call method of PHP-DI Container receives 2 arguments, handler and parameters, I can see that HandlerResolverInterface contains the resolve method with the handler, but, what about the $vars?, I need $vars in resolver.
Hi,
I have an issue about route parameters and Dependency Injection usign PHP-DI.
This work's fine for routes like this
But doesn't work's for routes with parameters like this
It is because the call method of PHP-DI Container receives 2 arguments, handler and parameters, I can see that HandlerResolverInterface contains the resolve method with the handler, but, what about the $vars?, I need $vars in resolver.
Any help are welcome.
The text was updated successfully, but these errors were encountered: