I’m trying to use apigility with doctrine’s mongodb odm.
I’ve set up my documents and configured the doctrine module as should.
I’ve inserted (manually) one document to mongo, and defined a code-based rest service, with its “fetch” method (in the resource class) to return the document's repository "find" return value.
When I call the endpoint (without the ID) I get an array of the single document I’ve inserted, but it’s not shown correctly:
{
"_links": {
"self": {
"href": "http://localhost:8888/posts"
}
},
"_embedded": {
"posts": [
{
"\u0000MyApp\\Document\\Post\u0000id": "5389db47075000812e55bd7d",
"\u0000MyApp\\Document\\Post\u0000title": "My Post",
"\u0000MyApp\\Document\\Post\u0000description": "This is my post",
"_links": {
"self": {
"href": "http://localhost:8888/posts/1"
}
}
}
]
},
"total_items": 1
}
There are (at least) two problems with this output:
- The key of each property is weirdly formatted. it contains the complete namespace with the document name, and the utf8 code for NULL
- The “self” link does not use the correct id (it uses the number 1 instead of the mongodb autogenerated id).
What is wrong/missing ?