7

I'm such a fucking idiot

I'm setting up an api and to prevent unwanted fields or circular dependencies from showing up I define what fields should appear in a few serialization yaml files.

These files define what fields should appear in a given context. The default context for every field is to always show the id, and only a call to /posts will give you all the fields of the posts for example. This means that if you retrieve a comment with a linked post, the post will only show up as an id, but the comment will have all its fields.

I've been struggling with a stupid problem for 2 hours, I could verify that the yaml files were loaded in, all entities had such a file and the configuration was exactly according to the docs.

Guess why my api calls still caused circular errors?

Because I forgot to do the $view->setContext$this->defaultContext); call that determines what context should be used for the response.

FUCK ME WHY DID IT TAKE SO FUCKING LONG TO FIGURE THAT OUT OMG

Google you say? Ofcourse I hunted google results! But I was unknowingly part of an XY problem and was looking for what the problem wasn't >:(

At least it works now, ugh

Comments
Add Comment