@mikro-orm/core 7.1.7-dev.9 → 7.1.8-dev.0

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.
@@ -291,7 +291,8 @@ export class EntityLoader {
291
291
  }
292
292
  for (const child of children) {
293
293
  const fk = child.__helper.__data[prop.mappedBy] ?? child[prop.mappedBy];
294
- if (fk) {
294
+ // check for `null`/`undefined` explicitly, the FK can be a falsy raw PK value like `0` (e.g. with `mapToPk`)
295
+ if (fk != null) {
295
296
  let key;
296
297
  if (targetKey) {
297
298
  // `fk` is the owner reference (resolve its targetKey) unless the relation maps to the raw PK value
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.1.7-dev.9",
3
+ "version": "7.1.8-dev.0",
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",
@@ -138,7 +138,8 @@ export class ChangeSetComputer {
138
138
  return data;
139
139
  }
140
140
  processProperty(changeSet, prop, target) {
141
- if (!target) {
141
+ // check for `null`/`undefined` explicitly, the target can be a falsy raw PK value like `0` (e.g. with `mapToPk`)
142
+ if (target == null) {
142
143
  const targets = Utils.unwrapProperty(changeSet.entity, changeSet.meta, prop);
143
144
  targets.forEach(([t]) => this.processProperty(changeSet, prop, t));
144
145
  return;
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.1.7-dev.9';
156
+ static #ORM_VERSION = '7.1.8-dev.0';
157
157
  /**
158
158
  * Checks if the argument is instance of `Object`. Returns false for arrays.
159
159
  */