mirror of
https://github.com/strapi/strapi.git
synced 2025-08-08 16:59:21 +00:00
Fixed ‘oneWay’ relation creating unnecessary attr
When ‘oneWay’ relation is created the target model file is also updated with a reference to the relation. This is not required for a oneWay relation since it never will or can be populated from the other way around.
This commit is contained in:
parent
0408368481
commit
ae29802c07
@ -56,4 +56,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
@ -46,4 +46,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
@ -48,4 +48,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
@ -44,4 +44,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
@ -201,6 +201,7 @@ module.exports = {
|
||||
};
|
||||
|
||||
switch (relation.nature) {
|
||||
case 'oneWay':
|
||||
case 'oneToOne':
|
||||
case 'manyToOne':
|
||||
attr.model = relation.target;
|
||||
@ -212,7 +213,9 @@ module.exports = {
|
||||
default:
|
||||
}
|
||||
|
||||
attr.via = relation.key;
|
||||
if(relation.nature !== 'oneWay') {
|
||||
attr.via = relation.key;
|
||||
}
|
||||
attr.dominant = relation.dominant;
|
||||
|
||||
if (_.trim(relation.pluginValue)) {
|
||||
@ -353,6 +356,8 @@ module.exports = {
|
||||
const attr = {};
|
||||
|
||||
switch (params.nature) {
|
||||
case 'oneWay':
|
||||
return;
|
||||
case 'oneToOne':
|
||||
case 'oneToMany':
|
||||
attr.model = model.toLowerCase();
|
||||
|
Loading…
x
Reference in New Issue
Block a user