nilportugues / php-json-api

JSON API transformer outputting valid (PSR-7) API Responses.
http://nilportugues.com
MIT License
71 stars 35 forks source link

Avoid adding unwanted resources to included member. #68

Closed franbenz closed 8 years ago

franbenz commented 8 years ago

I'll try to add a test for this later. This does not seem to affect your current tests. I don't know if I could add a test with Doctrine entities. Would you recommend adding this kind of test?

nilportugues commented 8 years ago

What's the usecase?

While the serializer does clean up most of the unwanted data based on the query params, you should be using the query params and passing them to Doctrine selecting what you want too.

As always, definately willing to merge the PR if you come with a better solution than currently available. Write the test and we'll see. :+1:

franbenz commented 8 years ago

I have a Doctrine entity with some referenced entities eagerly fetched(to avoid closures). I only want to return the top level entity, including it's foreign key references in the relationships member, but not including the referenced entities in the included member.