We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I try to serialise an object but I get an error with the URL generation for the self url property.
self url
This is my mapping:
mapping: class: AppBundle\User alias: User id_properties: - id urls: self: get_user
This is get_user route definition (which works if I call it directly):
get_user
@Route( path="/user/{id}", name="get_user", requirements={"id": "\d+"} )
And this is the error I get:
Parameter "id" for route "get_user" must match "\d+" ("{id}" given) to generate a corresponding URL.
If I change the mapping to something like
# ... urls: self: route_without_parameters # ...
I get a response but without any url referencing that route:
{ "data": { "type": "user", "id": "1", "attributes": { ... } }, "jsonapi": { "version": "1.0" } }
The text was updated successfully, but these errors were encountered:
Can be closed, if I change the requirements of the route to requirements={"{id}": "\d+"} (note the braces in the parameter name) it works.
requirements={"{id}": "\d+"}
I still don't know why Symfony allows both ways of defining requirements tho.
Sorry, something went wrong.
No branches or pull requests
I try to serialise an object but I get an error with the URL generation for the
self url
property.This is my mapping:
This is
get_user
route definition (which works if I call it directly):And this is the error I get:
If I change the mapping to something like
I get a response but without any url referencing that route:
The text was updated successfully, but these errors were encountered: