@reldens/storage 0.10.0-beta.36 → 0.10.0-beta.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/base-driver.js
CHANGED
|
@@ -162,7 +162,7 @@ class BaseDriver
|
|
|
162
162
|
Logger.error('Custom query method not found in raw model.', methodName, this.rawModel);
|
|
163
163
|
return false;
|
|
164
164
|
}
|
|
165
|
-
return this.rawModel[methodName](methodOptions);
|
|
165
|
+
return this.rawModel[methodName](methodOptions, this);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
}
|
|
@@ -132,7 +132,7 @@ class MikroOrmDriver extends BaseDriver
|
|
|
132
132
|
|
|
133
133
|
async loadAllWithRelations(relations)
|
|
134
134
|
{
|
|
135
|
-
let entities = await this.
|
|
135
|
+
let entities = await this.loadAll();
|
|
136
136
|
return await this.appendRelationsToCollection(entities, relations);
|
|
137
137
|
}
|
|
138
138
|
|
|
@@ -233,7 +233,7 @@ class MikroOrmDriver extends BaseDriver
|
|
|
233
233
|
{
|
|
234
234
|
// @TODO - BETA - Refactor. I would like to use populate but it may not work if the driver is not Mongo DB.
|
|
235
235
|
if(typeof this.rawModel.entity.relationsMappings !== 'function'){
|
|
236
|
-
return
|
|
236
|
+
return entitiesCollection;
|
|
237
237
|
}
|
|
238
238
|
if(!sc.isArray(relations) || 0 === relations.length){
|
|
239
239
|
relations = Object.keys(this.rawModel.entity.relationsMappings() || {});
|
|
@@ -251,7 +251,7 @@ class MikroOrmDriver extends BaseDriver
|
|
|
251
251
|
{
|
|
252
252
|
// @TODO - BETA - Refactor and improve.
|
|
253
253
|
if(typeof this.rawModel.entity.relationsMappings !== 'function'){
|
|
254
|
-
return
|
|
254
|
+
return entity;
|
|
255
255
|
}
|
|
256
256
|
let relationsMappings = this.rawModel.entity.relationsMappings();
|
|
257
257
|
for(let i of relations){
|
|
@@ -266,6 +266,7 @@ class MikroOrmDriver extends BaseDriver
|
|
|
266
266
|
entity[i] = await relationRepository.loadBy(relation.join.to, entity[relation.join.from]);
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
+
return entity;
|
|
269
270
|
}
|
|
270
271
|
|
|
271
272
|
async createNested(newInstance, params)
|