Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

HasManyThrough with unlimited intermediate models. #259

Closed
meideros opened this issue Dec 2, 2020 · 9 comments
Closed

HasManyThrough with unlimited intermediate models. #259

meideros opened this issue Dec 2, 2020 · 9 comments
Labels
feature request A feature that does not yet exist but will be a good addition to the library hard These issues are geared for people who have contributed to the project a lot help wanted Extra attention is needed

Comments

@meideros
Copy link

meideros commented Dec 2, 2020

I realize that orator orm does not allow us to apply hasmanythrough between more than three models, and since masonite orm is a package that aims to replace orator orm, I suggest that this be possible with masinite orm.

@josephmancuso
Copy link
Member

Transferring this to the orm repo

@josephmancuso josephmancuso transferred this issue from MasoniteFramework/masonite Dec 5, 2020
@josephmancuso
Copy link
Member

@meideros how do you expect something like this to look? This would require a huge and confusing chain of primary keys and models.

If these relationships are too distant it might make more sense from a database perspective to denormalize a bit

@josephmancuso
Copy link
Member

It would have to work like this

https://github.com/staudenmeir/eloquent-has-many-deep

@josephmancuso josephmancuso added feature request A feature that does not yet exist but will be a good addition to the library hard These issues are geared for people who have contributed to the project a lot labels Dec 11, 2020
@josephmancuso josephmancuso added the help wanted Extra attention is needed label Jan 9, 2021
@jpmateo022
Copy link

It would have to work like this

https://github.com/staudenmeir/eloquent-has-many-deep

This is actually a good feature to add sometimes I have this kind of scenario in my app.

@meideros
Copy link
Author

meideros commented Feb 8, 2021

Exactly it will look like this
https://github.com/staudenmeir/eloquent-has-many-deep

@projectmentor
Copy link

Guys I think this is the right place to share another very good breakdown of this requirement. I constantly refer back to this article in my Laravel development. Hope it helps.
https://p.softonsofa.com/laravel-querying-any-level-far-relations-with-simple-trick/

@josephmancuso
Copy link
Member

If I have some extra time on my hands I can work on this but it's not something I can get to soon. I am willing to test and review any pull requests that attempt to solve this

@projectmentor
Copy link

I'm just not that good in Python to be of much help, but I think that the "trick" in the above example is passing a reference (pointer) back from the lambda (?) function which helps to avoid a great deal of effort otherwise. hope I'm using the correct python terms

@josephmancuso
Copy link
Member

@projectmentor yeah that might actually work. Thats a nice little workout. I'd have to try it to see if it works here

@MasoniteFramework MasoniteFramework locked and limited conversation to collaborators Aug 11, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
feature request A feature that does not yet exist but will be a good addition to the library hard These issues are geared for people who have contributed to the project a lot help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants