13.
Embedding Objects with Hal?
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
Whoops, an error! Please, try again later.
2 Comments
Hi,
I have a small interrogation.
In a rest world, what is the best between embed the relation with Hatoeos or Expose the doctrine relation ?
Thanks in advance.
Yo Chuck!
Haha, I don't know :). I mean, the "best practice" is to choose a standard - whether it's HAL, JSON API, or whatever - and put make your responses look like they should. For HAL, you're supposed to put things under _embedded. For JSON API, it's different. So, I would say that *if* you find a standard that you really like and are comfortable following, then follow its rules completely. Otherwise, you're kind of "doing your own thing", which is "frowned upon", but happens all the time. And in that case, I like simple structures, so I just exposed the doctrine relation.
I hope that helps! There's still a lot in REST that is subjective. I think we *are* moving towards standards everywhere, but those standards (and the tools that make them easy to use) are still developing.
Cheers!
"Houston: no signs of life"
Start the conversation!