-
-
Notifications
You must be signed in to change notification settings - Fork 266
Fixed the custom query not being handled by interface's relations #486
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
Fixed the custom query not being handled by interface's relations #486
Conversation
Found out that interfaces public function types were useless |
Phu, the changes seem quite complex… I mean, on one side it looks like you just moved stuff around into a dedicated method, but hard to say. Btw, this one test is failing; what is your test expectation here? I'm a bit unsure if this change / added complexity is worth it, in its current form (no better suggestion though yet). |
The changes are pretty simple actually. Instead of executing all the code before any database request, in the case of an interface's relation, it is executed on the relation's query, as we don't know what model will be requested. Maybe this solution is better than nothing, and if anyone complains about the complexity, or anything, maybe someone will PR something else? Anyway, if anyone has something better in mind... |
Ok, thx for the info. I will take a closer look for the review, but that might take a while. If you want to add more details to the source changes (i.e. via github inline comments) to guide the reviewers, that would be much appreciated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments
Thanks for your effort and your patience so far, really appreciated. I took a longer look today and, whilst not easy, the approach seems 👍 to me! But my feeling is that it's lacking tests. Only one existing test adapt (which I remember was added in advance for exactly this moment) isn't much. My suggestion would be these steps in order:
How does that sound for your? PS: without getting ahead, Thanks! |
285c7c8
to
bc6e445
Compare
@EdwinDayot I see so often that you've to make micro commits for the StyleCI violations: it should be rather easy => just click on the "Details" and download / apply the patch. Good news: we want to switch to something else which allows devs to simply run php cs fixer locally, but it's not yet done => #502 |
Could not find the issue with Laravel 5.5 for the moment, if anyone has an idea... EDIT: I'm querying {
userQuery {
id
likes{
likable{
id
title
likes{
id
}
}
}
}
} the |
Yeah, that's what I am doing. I wasn't aware of this feature at the beginning, but now, I'm using it :) |
Help wanted |
Ops, the StyleCI integration is still active. On it! |
I believe there's single "fix" for this problem: Laravel 5.5 simply generates a different query and I've adapted to test to consider a different assertion 🤷♀️ Tests are all green now (ignore StyleCI…) Is this PR ready for review? I just noticed a lot of whitespace changes on phpdoc in |
The PHPDoc has been fixed |
5980885
to
703b30e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Had a long way coming ;)
I took the liberty and:
- squashed the 155 (!) commits into one…
I didn't see much value in this kind of history; mostly it was style fixes - added changelog/readme update
Would be great if you could check them
I've leave it up for feedback of others a few days more, otherwise I plan to merge it somewhen next week.
'alias' => 'title', | ||
], | ||
] + $interface->getFields(); | ||
return $interface->getFields(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change actually related somehow or just a cleanup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some cleanup :)
Readme sounds good to me |
Preparing the merge now |
# Conflicts: # CHANGELOG.md
Had to restart the travis jobs, thus it took longer. They were all green the first time, but the feedback loop to github didn't seem to work 🤷♀️ Retriggering the jobs on travis fixed it 👍 Thanks for the PR :) |
Nice :) |
Fixes the #421
An
Interface
requires apublic function types
returning an array ofGraphQL::type()
if it contains a relation with a customquery
Still, I'm not a huge fan of this method, so every new idea is appreciated!