Compare commits

...

2 Commits

@ -1,6 +1,6 @@
{
"name": "dlayer-knex",
"version": "0.2.0",
"version": "0.2.1",
"main": "src/index.js",
"repository": "https://git.cryto.net/joepie91/dlayer-knex.git",
"author": "Sven Slootweg <admin@cryto.net>",

@ -216,7 +216,13 @@ module.exports = {
if (remoteTableLayout[foreignKey.column].isPrimaryKey === true) {
let field = [ localField, async function (_, { $make, $getProperty }) {
return $make(`dlayer-knex.${foreignKey.table}`, { id: await $getProperty(this, name) })
let id = await $getProperty(this, name);
if (id != null) {
return $make(`dlayer-knex.${foreignKey.table}`, { id: id });
} else {
return null;
}
}];
selfRelationFields.push(field);

Loading…
Cancel
Save