dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 379 forks source link

Is it possible to combine 2+ tables with hasMany? #691

Closed lvanbuiten closed 8 years ago

lvanbuiten commented 8 years ago

Hi guys,

Is it somehow possible to create a merged table with more than two identifiers? In the wiki page it is possible to add more columns, for example "why" on this page: https://github.com/dresende/node-orm2/wiki/hasMany.

But i would like to have it like this: users_companies { user_id, company_id, permission_id } where permission_id is an id of the 3th table.

I know i can do this by creating a custom function which fetch the permission in the user/company model on request, but i would rather have the 'cleaner' version.

Thanks in advance!

dxg commented 8 years ago

Not that I'm aware of.

lvanbuiten commented 8 years ago

Unfortunately for me then, but i almost implemented the alternative. Thx anyway!