mirror of
https://github.com/strapi/strapi.git
synced 2025-12-13 07:55:33 +00:00
Fix 1059
This commit is contained in:
parent
f91be5ce63
commit
596adb5f61
@ -52,4 +52,4 @@
|
|||||||
"npm": ">= 5.0.0"
|
"npm": ">= 5.0.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
@ -1 +1 @@
|
|||||||
{}
|
{}
|
||||||
|
|||||||
@ -47,4 +47,4 @@
|
|||||||
"npm": ">= 5.0.0"
|
"npm": ">= 5.0.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
@ -51,4 +51,4 @@
|
|||||||
"npm": ">= 5.0.0"
|
"npm": ">= 5.0.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
@ -48,4 +48,4 @@
|
|||||||
"npm": ">= 5.0.0"
|
"npm": ">= 5.0.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
@ -48,4 +48,4 @@
|
|||||||
"npm": ">= 3.0.0"
|
"npm": ">= 3.0.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
@ -55,4 +55,4 @@
|
|||||||
"npm": ">= 5.0.0"
|
"npm": ">= 5.0.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
@ -140,30 +140,16 @@ module.exports = {
|
|||||||
types.current = 'modelD';
|
types.current = 'modelD';
|
||||||
|
|
||||||
// We have to find if they are a model linked to this key
|
// We have to find if they are a model linked to this key
|
||||||
_.forIn(_.omit(models, currentModelName || ''), model => {
|
const model = models[association.model]
|
||||||
Object.keys(model.attributes)
|
const attribute = model.attributes[association.via];
|
||||||
.filter(key => key === association.via)
|
|
||||||
.forEach(attr => {
|
|
||||||
const attribute = model.attributes[attr];
|
|
||||||
|
|
||||||
if (attribute.hasOwnProperty('via') && attribute.via === key && attribute.hasOwnProperty('collection') && attribute.collection !== '*') {
|
if (attribute.hasOwnProperty('via') && attribute.via === key && attribute.hasOwnProperty('collection') && attribute.collection !== '*') {
|
||||||
types.other = 'collection';
|
types.other = 'collection';
|
||||||
|
} else if (attribute.hasOwnProperty('model') && attribute.model !== '*') {
|
||||||
// Break loop
|
types.other = 'model';
|
||||||
return false;
|
} else if (attribute.hasOwnProperty('collection') || attribute.hasOwnProperty('model')) {
|
||||||
} else if (attribute.hasOwnProperty('model') && attribute.model !== '*') {
|
types.other = 'morphTo';
|
||||||
types.other = 'model';
|
}
|
||||||
|
|
||||||
// Break loop
|
|
||||||
return false;
|
|
||||||
} else if (attribute.hasOwnProperty('collection') || attribute.hasOwnProperty('model')) {
|
|
||||||
types.other = 'morphTo';
|
|
||||||
|
|
||||||
// Break loop
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else if (association.hasOwnProperty('model')) {
|
} else if (association.hasOwnProperty('model')) {
|
||||||
types.current = 'model';
|
types.current = 'model';
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user