Reputation: 1653
For example I have a Guardian entity with a Student entity. I would like to configure their many to many relationship in TypeORM as another entity. Let's call it StudentGuardianRelationship. Why? Because we need to show what kind of relationship a guardian has towards a student e.g. parent, aunt, grandparent, and so on.
In Rails' ActiveRecord this is accomplished via 'through':
http://guides.rubyonrails.org/association_basics.html#the-has-many-through-association
Does TypeORM support something like this or is the only possible way to have both Student and Guardian each have a oneToMany with StudentGuardianRelationship?
Upvotes: 1
Views: 994
Reputation: 1923
A many-to-many relationship can be decomposed into two many to one (to many) relationships
Student -> StudentGuardianRelationship <- Guardian
As of yet - there isn’t a way to do this directly.
Upvotes: 1