-
Notifications
You must be signed in to change notification settings - Fork 603
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
Many-To-Many Through patch #1227
Conversation
…he schema processor, don't load them twice
@particlebanana flagging throughTable true or false is'nt suffisant to correct through associations. i propose to add this in schema to correct the problem :
here we save the other part of throughTable in a relation dot notation key. |
@atiertant this fixes the issue shown in the test. It only loads the I'm not sure I understand the issue. Using If you are saying you want three levels of results for many-to-many through that is a separate feature. I think most of that logic would live in waterline-cursor but would take some work. That is separate from this issue. So to clear up this allows you to have a collection that can work as both a normal collection and a junction table. To have a collection that returns the values on the throughTable when populating either side (User, Car) is a different issue and involves work with the cursor and elsewhere. |
@particlebanana i was not talking about a new feature but bug fix.(of course using dot notation open deep features but this is not the question here) |
@particlebanana i had some tests,please a look at this: https://github.com/atiertant/waterline/blob/manytomanythrough/test/unit/query/associations/manyToManyThrough.js |
@atiertant thanks, looking into it. |
@atiertant Ah I see now why this is needed. It was dumbly just looking for the other key in the junction table. Ok I will close mine and go with yours. The |
This should resolve issue #1133 discovered by @atiertant. It uses the patched version of Waterline-Schema from balderdashy/waterline-schema#32 to use the
throughTable
flag.If everything looks good we will need to bump the minimum version of waterline-schema once this is merged.
This is an alternative for #1134 and includes the unit test from that PR.
EDIT: to be clear this isn't adding any new
through
support. Only fixing an issue with the support that already existed.