dresende / node-orm2

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

No getter/setter functions - reverse relationship on hasOne #751

Open PrasannaVenkadesh opened 7 years ago

PrasannaVenkadesh commented 7 years ago

I have two models.

  1. Category
  2. Resource

I have defined the hasOne relationship on Resource model like this.

Resource.hasOne('category', db.models.category, { 'reverse': 'resources' });

After db sync, resource.getCategory(function) is available but, category.getResources(function) has not been made available.

node_orm_issue

P.S: Using node-orm2 version 3.1.0 and nodejs v6.2.0

diaakasem commented 7 years ago

Same here ...

ModelOne.hasOne('model_two', ModelTwo, { reverse: 'model_one', autoFetch: true });

Unable to find model_two.getModel_one()