Hi, just started using both League\Container and League\Route and have been on this for the entire weekend, but still fail. This error is one that I don't know how to tackle:
<b>Fatal error</b>: Uncaught League\Container\Exception\NotFoundException: Unable to resolve a value for parameter (dsn) in the function/method (__construct) in [...]/vendor/league/container/src/Argument/ArgumentResolverTrait.php:79
Stack trace:
#0 [internal function]: League\Container\ReflectionContainer->League\Container\Argument\{closure}(Object(ReflectionParameter))
#1 [...]/vendor/league/container/src/Argument/ArgumentResolverTrait.php(84): array_map(Object(Closure), Array)
#2 [...]/vendor/league/container/src/ReflectionContainer.php(52): League\Container\ReflectionContainer->reflectArguments(Object(ReflectionMethod), Array)
#3 [...]/vendor/league/container/src/Container.php(183): League\Container\ReflectionContainer->get('Aura\\Sql\\Extend...')
#4 [...]/vendor/league/container/src/Argument/ArgumentResolverTrait.php(45): League\Container\Container->get('Aura\\Sql\\Extend...')
#5 [...]/vendor/league/container/src/Argument/ArgumentResolverTrait.php(86): League\Contai in <b> [...]/vendor/league/container/src/Argument/ArgumentResolverTrait.php</b> on line <b>79</b>
The parameter $dsn is required to construct the Aura\Sql\ExtendedPdo object. However, I can succesfully get the ExtendedPdo object from the container and I can even get a model instance in which the ExtendedPdo object is injected via the constructor. As such, I don't think the ExtendedPdo construction nor the League\Container setup is incorrect - I seem to fail at glueing everything together in League\Route.
These are the excerpts I believe to be relevant when setting up the Route ('dbpro' is an alias for a lazy loaded ExtendedPdo object - The ServiceProvider is an exact copy/paste from the docs, in which I replaced Zend with Laminas):
$container = new League\Container\Container;
$container->delegate( new League\Container\ReflectionContainer );
$container->add('modl_party', App\Model\Party::class)->addArgument('dbpro');
$container->add('ctrl_party', App\Controllers\PartyController::class)->addArgument('modl_party');
$container
->addServiceProvider('App\ServiceProvider\LaminasDiactorosServiceProvider');
$strategy = (new League\Route\Strategy\ApplicationStrategy)->setContainer($container);
$router = (new League\Route\Router)->setStrategy($strategy);
$router->group('/API/v1', function (League\Route\RouteGroup $route)
{
$route->map('GET', '/party/{id}', 'App\Controllers\PartyController::get');
$route->map('GET', '/parties/{dos_nr}', 'App\Controllers\PartiesController::get');
});
´´´
And this is where it fails:
Hi, just started using both League\Container and League\Route and have been on this for the entire weekend, but still fail. This error is one that I don't know how to tackle:
The parameter $dsn is required to construct the Aura\Sql\ExtendedPdo object. However, I can succesfully get the ExtendedPdo object from the container and I can even get a model instance in which the ExtendedPdo object is injected via the constructor. As such, I don't think the ExtendedPdo construction nor the League\Container setup is incorrect - I seem to fail at glueing everything together in League\Route.
These are the excerpts I believe to be relevant when setting up the Route ('dbpro' is an alias for a lazy loaded ExtendedPdo object - The ServiceProvider is an exact copy/paste from the docs, in which I replaced Zend with Laminas):
$response = $router->dispatch( $container->get('Laminas\Diactoros\ServerRequest'), $container->get('Laminas\Diactoros\Response') );