@mikro-orm/knex 6.0.0-dev.36 → 6.0.0-dev.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/package.json +3 -3
- package/query/QueryBuilder.js +21 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.0.0-dev.
|
|
3
|
+
"version": "6.0.0-dev.37",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"sqlstring": "2.3.3"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@mikro-orm/core": "^5.6.
|
|
66
|
+
"@mikro-orm/core": "^5.6.9"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "~6.0.0-dev.
|
|
69
|
+
"@mikro-orm/core": "~6.0.0-dev.37"
|
|
70
70
|
}
|
|
71
71
|
}
|
package/query/QueryBuilder.js
CHANGED
|
@@ -466,7 +466,27 @@ class QueryBuilder {
|
|
|
466
466
|
if (this._joinedProps.size > 0) {
|
|
467
467
|
res = this.driver.mergeJoinedResult(res, this.mainAlias.metadata);
|
|
468
468
|
}
|
|
469
|
-
|
|
469
|
+
const entities = [];
|
|
470
|
+
function propagatePopulateHint(entity, hint) {
|
|
471
|
+
(0, core_1.helper)(entity).__serializationContext.populate ??= hint;
|
|
472
|
+
hint.forEach(pop => {
|
|
473
|
+
const value = entity[pop.field];
|
|
474
|
+
if (core_1.Utils.isEntity(value, true)) {
|
|
475
|
+
(0, core_1.helper)(value).populated();
|
|
476
|
+
propagatePopulateHint(value, pop.children ?? []);
|
|
477
|
+
}
|
|
478
|
+
else if (core_1.Utils.isCollection(value)) {
|
|
479
|
+
value.populated();
|
|
480
|
+
value.getItems(false).forEach(item => propagatePopulateHint(item, pop.children ?? []));
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
for (const r of res) {
|
|
485
|
+
const entity = this.em.map(this.mainAlias.entityName, r, { schema: this._schema });
|
|
486
|
+
propagatePopulateHint(entity, this._populate);
|
|
487
|
+
entities.push(entity);
|
|
488
|
+
}
|
|
489
|
+
return entities;
|
|
470
490
|
}
|
|
471
491
|
/**
|
|
472
492
|
* Executes the query, returning the first result or null
|