@mikro-orm/core 6.5.2-dev.1 → 6.5.2-dev.3

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.
@@ -36,7 +36,7 @@ export interface AssignOptions<Convert extends boolean> {
36
36
  */
37
37
  onlyProperties?: boolean;
38
38
  /**
39
- * With `onlyOwnProperties` enabled, to-many relations are skipped, and payloads of to-one relations are converted
39
+ * With `onlyOwnProperties` enabled, inverse sides of to-many relations are skipped, and payloads of other relations are converted
40
40
  * to foreign keys. Defaults to `false`.
41
41
  */
42
42
  onlyOwnProperties?: boolean;
@@ -45,9 +45,17 @@ class EntityAssigner {
45
45
  }
46
46
  const prop = { ...props[propName], name: propName };
47
47
  if (prop && options.onlyOwnProperties) {
48
- if ([enums_1.ReferenceKind.MANY_TO_MANY, enums_1.ReferenceKind.ONE_TO_MANY].includes(prop.kind)) {
48
+ if ([enums_1.ReferenceKind.ONE_TO_MANY].includes(prop.kind)) {
49
49
  return;
50
50
  }
51
+ if ([enums_1.ReferenceKind.MANY_TO_MANY].includes(prop.kind)) {
52
+ if (!prop.owner) {
53
+ return;
54
+ }
55
+ else if (value?.map) {
56
+ value = value.map((v) => Utils_1.Utils.extractPK(v, prop.targetMeta));
57
+ }
58
+ }
51
59
  if ([enums_1.ReferenceKind.MANY_TO_ONE, enums_1.ReferenceKind.ONE_TO_ONE].includes(prop.kind)) {
52
60
  value = Utils_1.Utils.extractPK(value, prop.targetMeta);
53
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "6.5.2-dev.1",
3
+ "version": "6.5.2-dev.3",
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.1",
66
66
  "globby": "11.1.0",
67
- "mikro-orm": "6.5.2-dev.1",
67
+ "mikro-orm": "6.5.2-dev.3",
68
68
  "reflect-metadata": "0.2.2"
69
69
  }
70
70
  }