mirror of
https://github.com/strapi/strapi.git
synced 2025-08-09 17:26:11 +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"
|
"npm": ">= 5.3.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
@ -46,4 +46,4 @@
|
|||||||
"npm": ">= 5.3.0"
|
"npm": ">= 5.3.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
@ -43,4 +43,4 @@
|
|||||||
"npm": ">= 5.3.0"
|
"npm": ">= 5.3.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
@ -43,4 +43,4 @@
|
|||||||
"npm": ">= 5.3.0"
|
"npm": ">= 5.3.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
@ -43,4 +43,4 @@
|
|||||||
"npm": ">= 5.3.0"
|
"npm": ">= 5.3.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
@ -48,4 +48,4 @@
|
|||||||
"npm": ">= 5.3.0"
|
"npm": ">= 5.3.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
@ -44,4 +44,4 @@
|
|||||||
"npm": ">= 5.3.0"
|
"npm": ">= 5.3.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
@ -43,4 +43,4 @@
|
|||||||
"npm": ">= 5.3.0"
|
"npm": ">= 5.3.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
@ -43,4 +43,4 @@
|
|||||||
"npm": ">= 5.3.0"
|
"npm": ">= 5.3.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
@ -201,6 +201,7 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
switch (relation.nature) {
|
switch (relation.nature) {
|
||||||
|
case 'oneWay':
|
||||||
case 'oneToOne':
|
case 'oneToOne':
|
||||||
case 'manyToOne':
|
case 'manyToOne':
|
||||||
attr.model = relation.target;
|
attr.model = relation.target;
|
||||||
@ -212,7 +213,9 @@ module.exports = {
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
attr.via = relation.key;
|
if(relation.nature !== 'oneWay') {
|
||||||
|
attr.via = relation.key;
|
||||||
|
}
|
||||||
attr.dominant = relation.dominant;
|
attr.dominant = relation.dominant;
|
||||||
|
|
||||||
if (_.trim(relation.pluginValue)) {
|
if (_.trim(relation.pluginValue)) {
|
||||||
@ -353,6 +356,8 @@ module.exports = {
|
|||||||
const attr = {};
|
const attr = {};
|
||||||
|
|
||||||
switch (params.nature) {
|
switch (params.nature) {
|
||||||
|
case 'oneWay':
|
||||||
|
return;
|
||||||
case 'oneToOne':
|
case 'oneToOne':
|
||||||
case 'oneToMany':
|
case 'oneToMany':
|
||||||
attr.model = model.toLowerCase();
|
attr.model = model.toLowerCase();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user