@mikro-orm/core 6.6.11-dev.3 → 6.6.11-dev.4
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 +12 -2
- package/package.json +2 -2
package/entity/EntityLoader.js
CHANGED
|
@@ -278,9 +278,19 @@ class EntityLoader {
|
|
|
278
278
|
for (const child of children) {
|
|
279
279
|
childrenMap.add((0, wrap_1.helper)(child).getSerializedPrimaryKey());
|
|
280
280
|
}
|
|
281
|
+
const isInverseOneToOne = prop.kind === enums_1.ReferenceKind.ONE_TO_ONE && !prop.owner;
|
|
281
282
|
for (const entity of entities) {
|
|
282
|
-
const
|
|
283
|
-
if (
|
|
283
|
+
const ref = entity[prop.name];
|
|
284
|
+
if (ref == null) {
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
const refPk = (0, wrap_1.helper)(ref).getSerializedPrimaryKey();
|
|
288
|
+
// For 1:1 inverse, `children` contains parent entities, so `childrenMap`
|
|
289
|
+
// has parent PKs — match against the entity's own PK, not the referenced entity's PK.
|
|
290
|
+
const childKey = isInverseOneToOne
|
|
291
|
+
? (0, wrap_1.helper)(entity).getSerializedPrimaryKey()
|
|
292
|
+
: refPk;
|
|
293
|
+
if (childrenMap.has(childKey) && !itemsMap.has(refPk)) {
|
|
284
294
|
entity[prop.name] = nullVal;
|
|
285
295
|
(0, wrap_1.helper)(entity).__originalEntityData[prop.name] = null;
|
|
286
296
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "6.6.11-dev.
|
|
3
|
+
"version": "6.6.11-dev.4",
|
|
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",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"esprima": "4.0.1",
|
|
65
65
|
"fs-extra": "11.3.3",
|
|
66
66
|
"globby": "11.1.0",
|
|
67
|
-
"mikro-orm": "6.6.11-dev.
|
|
67
|
+
"mikro-orm": "6.6.11-dev.4",
|
|
68
68
|
"reflect-metadata": "0.2.2"
|
|
69
69
|
}
|
|
70
70
|
}
|