-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
feat: Support Many to Many relationships #139
base: master
Are you sure you want to change the base?
Conversation
@boazpoolman , could you review it? 😃 |
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 basing this question off of your screenrecording;
Is it possible to select different indexes in the array? For example [relation[1].field]
@boazpoolman , it isn't possible. Because the validation pattern only accepts the exact allowed field names, we can improve it in the next PR. |
I would suggest solving that in this PR. |
@boazpoolman , it's fixed in my latest commit 😃 . I'm fixing the lint issues |
@boazpoolman , it's ready to review it |
Great. I'll review as soon as I've got the time! |
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.
The eslint job is still failing.
Also it's very hard to review this PR because you've auto-fixed the files based on some prettier config that does not originate from the plugin.
It would be amazing if you could revert all those changes so that the diff of this PR is simply the code needed to implement the Many to Many relation feature.
@boazpoolman It's ready to review. The changes are:
Now, it's easier to review it. |
@boazpoolman , could you review it? |
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.
For starters:
Thanks @candidosales for submitting this PR.
I've reviewed it and I'm having some issues.
- If I use a
toOne
relation I see the dynamic value I can insert into the pattern (e.g. [category.id]). But if I add atoMany
relation I don't see the field in the pattern description. - If I add the dynamic value anyways (e.g. [category[0].id]) and I try to save I get an internal server error.
Please see my video in which you can witness these two issues:
sitemap.mp4
@boazpoolman , great! Thanks for reviewing it! I'll take a look. |
Have you been able to look at my feedback? |
Hi @boazpoolman , I didn't have time yet to improve it. Sorry about that. Many things are happening. |
Hi, I think this is a much needed functionality. Is there any timeline for this PR @candidosales ? Usually collection types like 'Blogs' and 'categories' tend to have a many to many relationship with the URL structure changing based on the category slug and the blog slug. So this feature could be really helpful for those kinds of setup. cc: @boazpoolman |
Finally, I have time to take a look. @boazpoolman, could you review it? |
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.
We have tested the new code you provided us and we still get an internal server error. We hope you can fix. We get the error error: Cannot read properties of null (reading '0') TypeError: Cannot read properties of null (reading '0')
as previewed in the video @boazpoolman previously sent.
Greetings, Mathijs from PluginPal
@MSACC, could you share a video showing the issue? I would like to replicate |
Mathijs experienced the same issues I did when I tested it. |
great feature guys, can't wait |
@candidosales, this is a useful feature, and I also have this use case in a project I'm working on. Would you like some help finishing this PR? |
What does it do?
getAllowedFields
showing fields with relationshipManyToMany
;mappedBy
andinversedBy
;validatePattern
to support fields with array. Ex:[categories[0].slug]
;Why is it needed?
You can select multiple relationships and their attributes using this feature.
How to test it?
CleanShot.2023-10-09.at.23.11.44.mp4
Related issue(s)/PR(s)
#78
Let us know if this is related to any issue/pull request