mirror of
https://github.com/strapi/strapi.git
synced 2026-01-03 10:46:21 +00:00
fix morphToMany order
This commit is contained in:
parent
eb8d79e0c8
commit
9830910312
@ -438,12 +438,13 @@ const createEntityManager = (db) => {
|
||||
|
||||
const { idColumn, typeColumn, typeField = '__type' } = morphColumn;
|
||||
|
||||
const rows = cleanRelationData.set.map((data) => ({
|
||||
const rows = cleanRelationData.set.map((data, idx) => ({
|
||||
[joinColumn.name]: id,
|
||||
[idColumn.name]: data.id,
|
||||
[typeColumn.name]: data[typeField],
|
||||
...(joinTable.on || {}),
|
||||
...(data.__pivot || {}),
|
||||
order: idx + 1,
|
||||
}));
|
||||
|
||||
if (isEmpty(rows)) {
|
||||
@ -657,12 +658,13 @@ const createEntityManager = (db) => {
|
||||
})
|
||||
.execute();
|
||||
|
||||
const rows = cleanRelationData.set.map((data) => ({
|
||||
const rows = cleanRelationData.set.map((data, idx) => ({
|
||||
[joinColumn.name]: id,
|
||||
[idColumn.name]: data.id,
|
||||
[typeColumn.name]: data[typeField],
|
||||
...(joinTable.on || {}),
|
||||
...(data.__pivot || {}),
|
||||
order: idx + 1,
|
||||
}));
|
||||
|
||||
if (isEmpty(rows)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user