smartprix / xorm

NodeJS ORM based on ObjectionJS with some extra utilities
18 stars 4 forks source link

Two Models with same `tableName` returns wrong instance when using loader #27

Closed rohit-gohri closed 5 years ago

rohit-gohri commented 5 years ago

Eg.:

class ProductA extends Model {
    static get tableName() { return 'Product' }
}

class ProductB extends Model {
    static get tableName() { return 'Product' }
}

async run() {
    console.log(await ProductA.loadById(1));
    console.log(await ProductB.loadById(1));
}

Logs 2 objects both instances of ProductA