mirror of
https://github.com/strapi/strapi.git
synced 2025-12-16 09:45:08 +00:00
Fix 1059
This commit is contained in:
parent
f91be5ce63
commit
596adb5f61
@ -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';
|
||||||
|
|
||||||
// Break loop
|
|
||||||
return false;
|
|
||||||
} else if (attribute.hasOwnProperty('model') && attribute.model !== '*') {
|
} else if (attribute.hasOwnProperty('model') && attribute.model !== '*') {
|
||||||
types.other = 'model';
|
types.other = 'model';
|
||||||
|
|
||||||
// Break loop
|
|
||||||
return false;
|
|
||||||
} else if (attribute.hasOwnProperty('collection') || attribute.hasOwnProperty('model')) {
|
} else if (attribute.hasOwnProperty('collection') || attribute.hasOwnProperty('model')) {
|
||||||
types.other = 'morphTo';
|
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