I try to serialise an object but I get an error with the URL generation for the self url property.
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):
@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"
}
}
I try to serialise an object but I get an error with the URL generation for the
self urlproperty.This is my mapping:
This is
get_userroute 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:
{ "data": { "type": "user", "id": "1", "attributes": { ... } }, "jsonapi": { "version": "1.0" } }