-
Notifications
You must be signed in to change notification settings - Fork 86
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
Support nested relations #17
Comments
Hi @ldiebold, First of all, thank you for the kind words! Honestly, I thought this is already supported 🤔 But either way, this is definitely something that will be introduced, if it is not supported. |
Found the cause - it is Will include the fix in v1.2 👌 |
I'm also facing this problem, would love to see this fix! Amazing work @alexzarbn. |
@alexzarbn thankyou!!! Also want to point out how beautiful your code is. Simple comments, easy to navigate... A true joy 💓 |
Thank you ~ Got it, will plan to implement the fix for this weekend. |
It took a lot of refactoring to get to its current state 😄 |
I noticed it works when you list them up, in my case: return [
'forumCategories',
'forumCategories.threads',
'forumCategories.threads.user',
]; But it doesn't recognise the resources, so I wanted to exclude the email from the 'user' relationship, but that didn't work through the resources. I hope you can also look to that! |
Have you tried explicitly setting the resource class? |
I'm using the default namespace/conventional way of creating resources. I've noticed if you want to manually 'register' them, they have to been put in a controller. In my case the 'user' relationship doesn't have a controller because it is a nested relationship. |
In that case you need to do the following:
|
Got it! I made a fault in my resource nesting, you're awesome! |
This is fixed in 1.1.3 release. In 1.2 release I am planning to add the ability to specify wildcard nested relations. It will remove the need for listing all nested relations, if all of them should be available for inclusion: protected function includes(): array
{
return ['user', 'posts.*']; // this is NOT released yet
} |
I was listing out my relations four levels deep like @PascalHesselink mentioned in their comment. The new 1.1.3 breaks this for some reason, I have not been able to dive into why but wanted to leave an update in case anyone else is having the same issue. I went back to 1.1.1 and my relations load again. |
Hi @joshuahill1609, Thank you for bringing that up. Could you please share the whitelisted includes array from your controller and the request url (with |
I am using the alwaysIncludes() function in the controller to always load these nested resources.
|
Does the |
@alexzarbn Yes, the relation method is cost_codes(). This is working for me now and broke when I upgraded to the new version. |
Okay, I will dig more into this issue. |
Relations whitelisting using wildcards is added in 1.2 release. |
Hello, i have updated to version 1.2 but when i use user.* in always include i get this error: |
Hi @alireza2281, Whitelisting of relations using wildcards is only supported in the |
Could you please upgrade to v1.2.2 and see, if it works? I was not able to replicate the issue though.. |
@alexzarbn hi again, |
Hi @alireza2281, Thank you, I will look into the issue. |
Recursive stuff is so confusing sometimes 😅 Please update to v1.2.2 - it will solve the problem. |
Would love to be able to
include
nested relations.Something like this:
would be able to save a few calls to the API!
Thanks a million for this package, I absolutely love it. So beautifully written 😃
The text was updated successfully, but these errors were encountered: