Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use select('resource_table.*') on query by default #274

Open
tembra opened this issue Dec 22, 2018 · 1 comment
Open

Use select('resource_table.*') on query by default #274

tembra opened this issue Dec 22, 2018 · 1 comment

Comments

@tembra
Copy link

tembra commented Dec 22, 2018

Hello guys!

In my API I do need to make some joins in the query to apply my filter logic. However if my joining table has the same field name of my resource table (main table) the joiner table's field replaces the one of main table. This is a Laravel/Eloquent problem, but forces me to add a $query->select('resource_table.*') at least the first time I make a join.

In your demo application you already makes use of resource_table. syntax when adding where to the query, because the same problem would happen.

So my question is: May we have this piece of code directly added to AbstractAdapter?

Actually you do not have in your code any select() function to the query even if sparse fields is given. I got that this is done by neomerx/json-api Encoder and ResourceObject through your default Encoder - that extends neomerx's one - and our resource Schema.

Thanks!

@lindyhopchris
Copy link
Member

Yes think there might be a case for doing something around select, particularly when sparse fieldsets are requested. I'm not sure I can prioritise this at the moment though as there's more than enough other stuff to sort out - but will leave this open so that we can add it in a future version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants