-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$request->getAttribute('id') is returning null #76
Comments
Hi, I have the same issue. |
Is this really correct @mnapoli? As stated in the Slim official documentation:
So you can for example have a middleware which sets in the request an attribute called "user" and have also a route with a "user" named argument, causing PHP-DI Slim bridge to override the original attribute value. The Slim documented way to access route parameters is with |
In the readme example Controllers as a services:
it show to get the route attribute
id
using$request->getAttribute('id')
but if i use this method i getnull
returned.my route is created like this:
and the controller looks like this:
The only way to get the name argument in my case is like this:
I understand I can also get it like this, so it's injected from the __invoke method parameters:
But the readme makes me believe the other way is also possible, somehow.
Is the readme wrong or is there some way to achieve this?
The text was updated successfully, but these errors were encountered: