law-common 10.46.1 → 10.46.3
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.
|
@@ -226,13 +226,37 @@ class EntityModelRelationHelper {
|
|
|
226
226
|
if (!(entityName in exports.entityEnumToEntityModel)) {
|
|
227
227
|
throw new Error(`Unknown entity: ${entityName}`);
|
|
228
228
|
}
|
|
229
|
-
const entityModels = entityMap[entityName]
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
229
|
+
const entityModels = entityMap[entityName];
|
|
230
|
+
for (const entity of entityModels) {
|
|
231
|
+
if (!(entityName in exports.entityEnumToEntityModel)) {
|
|
232
|
+
throw new Error(`Unknown entity: ${entityName}`);
|
|
233
|
+
}
|
|
234
|
+
if (!this.entityMap[entityName]) {
|
|
235
|
+
this.entityMap[entityName] = [];
|
|
236
|
+
}
|
|
237
|
+
if (!this.entityModelMap[entityName]) {
|
|
238
|
+
this.entityModelMap[entityName] = [];
|
|
239
|
+
}
|
|
240
|
+
if (!this.entityModelIndexMap[entityName]) {
|
|
241
|
+
this.entityModelIndexMap[entityName] = {};
|
|
242
|
+
}
|
|
243
|
+
this.entityMap[entityName].push(entity);
|
|
244
|
+
const entityModel = exports.entityEnumToEntityModel[entityName
|
|
245
|
+
// @ts-ignore
|
|
246
|
+
](entity);
|
|
247
|
+
// @ts-ignore
|
|
248
|
+
this.entityModelMap[entityName].push(entityModel);
|
|
249
|
+
// @ts-ignore
|
|
250
|
+
this.entityModelIndexMap[entityName][entityModel.id] =
|
|
251
|
+
// @ts-ignore
|
|
252
|
+
entityModel;
|
|
253
|
+
if (config.populateRelations) {
|
|
254
|
+
models.push(entityModel);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
233
257
|
}
|
|
234
258
|
for (const model of models) {
|
|
235
|
-
this.
|
|
259
|
+
this.populateRelationsByEntityModel(model);
|
|
236
260
|
}
|
|
237
261
|
return EntityModelRelationHelper.getClone(this);
|
|
238
262
|
}
|