adonisjs / lucid

AdonisJS SQL ORM. Supports PostgreSQL, MySQL, MSSQL, Redshift, SQLite and many more
https://lucid.adonisjs.com/
MIT License
1.07k stars 191 forks source link

HasOneThrough #960

Open mattkenefick opened 1 year ago

mattkenefick commented 1 year ago

Why this feature is required (specific use-cases will be appreciated)?

I have a junction table defining relationships between ItemA and ItemB. I'd like to get a hasOne which works ItemA -> Relationships -> ItemB.

It works right now with HasManyThrough, but is returned as an array rather than an object.

Have you tried any other work arounds?

Yeah, but I think it would be better as a core feature syntactically since it would fit in with the other relationships like hasManyThrough and manyToMany.

Are you willing to work on it with little guidance?

Maybe.