@mikro-orm/core 7.2.4-dev.8 → 7.2.4-dev.9
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/entity/EntityLoader.js +8 -2
- package/package.json +1 -1
- package/utils/Utils.js +1 -1
package/entity/EntityLoader.js
CHANGED
|
@@ -312,9 +312,15 @@ export class EntityLoader {
|
|
|
312
312
|
}
|
|
313
313
|
initializeManyToMany(filtered, children, prop, field, customOrder, partial, readonly) {
|
|
314
314
|
if (prop.mappedBy) {
|
|
315
|
+
// group children by owner in one pass
|
|
316
|
+
const map = new Map(filtered.map(entity => [entity, []]));
|
|
317
|
+
for (const child of children) {
|
|
318
|
+
for (const owner of child[prop.mappedBy].getItems(false)) {
|
|
319
|
+
map.get(owner)?.push(child);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
315
322
|
for (const entity of filtered) {
|
|
316
|
-
|
|
317
|
-
entity[field].hydrate(items, true, partial, readonly);
|
|
323
|
+
entity[field].hydrate(map.get(entity), true, partial, readonly);
|
|
318
324
|
}
|
|
319
325
|
}
|
|
320
326
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "7.2.4-dev.
|
|
3
|
+
"version": "7.2.4-dev.9",
|
|
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
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
package/utils/Utils.js
CHANGED
|
@@ -153,7 +153,7 @@ export function parseJsonSafe(value) {
|
|
|
153
153
|
/** Collection of general-purpose utility methods used throughout the ORM. */
|
|
154
154
|
export class Utils {
|
|
155
155
|
static PK_SEPARATOR = '~~~';
|
|
156
|
-
static #ORM_VERSION = '7.2.4-dev.
|
|
156
|
+
static #ORM_VERSION = '7.2.4-dev.9';
|
|
157
157
|
/** Default session variable name backing an RLS filter argument (`current_setting('mikro.<filter>.<arg>')`). */
|
|
158
158
|
static getRlsSettingName(filterName, argName) {
|
|
159
159
|
return `mikro.${filterName}.${argName}`;
|