I’m looking for a backend in PHP to serve my EMBER-DATA , my choise is https://github.com/alixaxel/ArrestDB , but it 's not 100% compatible ember data. so , i’m working to adapte it .
The question is : the URL sending by ember data is :
You can see, no comments id are in the json. Of course, i have two models with hasMany and belongsTo and sync:true . but is it php-REST responsability to add id comments to the response, or ember data must send another request the get the necessary .?
I’ve checked the PHP library you are using, this looks REALLY bad (it is doing POST without validating any data, that’s super dangerous…). In all cases, most REST library do not format responses the way Ember expect it, so you will indeed need to do the joins yourself, and output the identifiers.
If you are using Zend Framework 2, I’m the author of ZfrRest that outputs responses in a format nearly ready-to consume by Ember-Data.
It depends on the Adapter/Serializer you’re using in Ember Data. I think if you’re using DS.ActiveModelSerializer, your back end is expected to provide comment_ids nested in the post json. And if your relationship is set to async:false, then the comment objects are expected to be sideloaded like this: