Closed greezlu closed 1 year ago
Created temporary patch for myself.
I'm using cweagans/composer-patches
for this.
"extra": {
"patches": {
"php-di/slim-bridge": {
"Fix missing controller argument": "patches/php-di/slim-bridge/issue-81.patch"
}
}
}
This isn't how this bridge is designed to work, check out this doc: https://github.com/PHP-DI/Slim-Bridge#controller-parameters
@mnapoli Yep, that's why I've opened this issue.
It just bother me. If I'm using slim official documentation with this bridge installed and I'm getting slim and not bridge error. It's nice feature and all but it should not break original method signature in my opinion.
I can see this more like an additional functionality rather than rule. For example:
It's not hard to bind arguments to $args
parameter and make them available by the name at the same time. It will not break original signature but allow to use this feature "safely". Also it should not be very memory consuming since usually there's a few arguments really.
Anyway, I want to see the resolution.
UPD Second version of patch to proof my point by keeping both functionalities. issue-81.patch
i stumbled across the same error... Would be nice to allow $args
too like @greezlu said
@mnapoli Hello. Any news?
Got error below during controller invocation.
Slim Application Error
The application could not run because of the following error:
Details
Type: Invoker\Exception\NotEnoughParametersException Code: 0 Message: Unable to invoke the callable because no value was given for parameter 3 ($args) File: /var/www/html/vendor/php-di/invoker/src/Invoker.php Line: 67
Trace
Description
composer.json
I think this problem is predictable. Right now
slim
using 3 parameters for controllers methods:ServerRequestInterface $request
ResponseInterface $response
array $args
And current invoker takes care only for first two:
Arguments are being just merged:
So my suggesting solution will be: