@mikro-orm/core 7.1.0-dev.49 → 7.1.0-dev.50
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 +1 -1
- package/unit-of-work/UnitOfWork.js +11 -1
- package/utils/Utils.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/core",
|
|
3
|
-
"version": "7.1.0-dev.
|
|
3
|
+
"version": "7.1.0-dev.50",
|
|
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",
|
|
@@ -378,10 +378,20 @@ export class UnitOfWork {
|
|
|
378
378
|
this.#identityMap.delete(entity);
|
|
379
379
|
}
|
|
380
380
|
// remove from referencing relations that are nullable
|
|
381
|
-
|
|
381
|
+
const entityMeta = helper(entity).__meta;
|
|
382
|
+
for (const prop of entityMeta.bidirectionalRelations) {
|
|
382
383
|
const inverseProp = prop.mappedBy || prop.inversedBy;
|
|
383
384
|
const relation = Reference.unwrapReference(entity[prop.name]);
|
|
384
385
|
const prop2 = prop.targetMeta.properties[inverseProp];
|
|
386
|
+
// skip relations that this entity's class can't actually participate in.
|
|
387
|
+
// happens with STI: a child meta picks up a sibling's inverse-side relation via the root,
|
|
388
|
+
// but the owning side targets the sibling — no collection can reference this entity.
|
|
389
|
+
const inverseTarget = prop2.targetMeta;
|
|
390
|
+
if (inverseTarget.abstract
|
|
391
|
+
? inverseTarget.root.class !== entityMeta.root.class
|
|
392
|
+
: inverseTarget.class !== entityMeta.class) {
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
385
395
|
if (prop.kind === ReferenceKind.ONE_TO_MANY && prop2.nullable && Utils.isCollection(relation)) {
|
|
386
396
|
for (const item of relation.getItems(false)) {
|
|
387
397
|
delete item[inverseProp];
|
package/utils/Utils.js
CHANGED
|
@@ -141,7 +141,7 @@ export function parseJsonSafe(value) {
|
|
|
141
141
|
/** Collection of general-purpose utility methods used throughout the ORM. */
|
|
142
142
|
export class Utils {
|
|
143
143
|
static PK_SEPARATOR = '~~~';
|
|
144
|
-
static #ORM_VERSION = '7.1.0-dev.
|
|
144
|
+
static #ORM_VERSION = '7.1.0-dev.50';
|
|
145
145
|
/**
|
|
146
146
|
* Checks if the argument is instance of `Object`. Returns false for arrays.
|
|
147
147
|
*/
|