@mikro-orm/knex 6.0.0-dev.94 → 6.0.0-dev.96
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/AbstractSqlDriver.js +5 -2
- package/package.json +3 -3
package/AbstractSqlDriver.js
CHANGED
|
@@ -662,8 +662,11 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
|
|
|
662
662
|
const pk = core_1.Utils.getCompositeKeyHash(item, meta);
|
|
663
663
|
if (map[pk]) {
|
|
664
664
|
joinedProps.forEach(hint => {
|
|
665
|
-
|
|
666
|
-
|
|
665
|
+
// Sometimes we might join a M:N relation with additional filter on the target entity, and as a result, we get
|
|
666
|
+
// the first result with `null` for all target values, which is mapped as empty array. When we see that happen,
|
|
667
|
+
// we need to merge the results of the next item.
|
|
668
|
+
if (Array.isArray(map[pk][hint.field]) && Array.isArray(item[hint.field]) && map[pk][hint.field].length === 0) {
|
|
669
|
+
item[hint.field].forEach((el) => map[pk][hint.field].push(el));
|
|
667
670
|
}
|
|
668
671
|
});
|
|
669
672
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.0.0-dev.
|
|
3
|
+
"version": "6.0.0-dev.96",
|
|
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",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"sqlstring": "2.3.3"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@mikro-orm/core": "^5.8.
|
|
66
|
+
"@mikro-orm/core": "^5.8.1"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "~6.0.0-dev.
|
|
69
|
+
"@mikro-orm/core": "~6.0.0-dev.96"
|
|
70
70
|
}
|
|
71
71
|
}
|