mirror of
https://github.com/strapi/strapi.git
synced 2025-10-14 17:43:01 +00:00
Merge pull request #1089 from strapi/fix-cm-entry-relations
Fix entry create relations
This commit is contained in:
commit
fc6e126165
@ -92,11 +92,16 @@ module.exports = {
|
||||
|
||||
const entry = request.toJSON ? request.toJSON() : request;
|
||||
|
||||
const relations = this.associations.reduce((acc, association) => {
|
||||
acc[association.alias] = params.values[association.alias];
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
return module.exports.update.call(this, {
|
||||
[this.primaryKey]: entry[this.primaryKey],
|
||||
values: _.assign({
|
||||
id: entry[this.primaryKey]
|
||||
}, params.values, entry)
|
||||
}, relations)
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -46,11 +46,19 @@ module.exports = {
|
||||
|
||||
const entry = request.toJSON ? request.toJSON() : request;
|
||||
|
||||
const relations = this.associations.reduce((acc, association) => {
|
||||
if (params.values[association.alias]) {
|
||||
acc[association.alias] = params.values[association.alias];
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
return module.exports.update.call(this, {
|
||||
[this.primaryKey]: entry[this.primaryKey],
|
||||
values: _.assign({
|
||||
id: entry[this.primaryKey]
|
||||
}, params.values, entry)
|
||||
}, relations)
|
||||
});
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user