mirror of
https://github.com/strapi/strapi.git
synced 2025-12-16 17:53:53 +00:00
Merge branch 'master' into fix/enumeration
This commit is contained in:
commit
cccf256bf7
@ -8,6 +8,10 @@ const utils = require('./utils');
|
||||
const relations = require('./relations');
|
||||
const { findComponentByGlobalId } = require('./utils/helpers');
|
||||
|
||||
const isPolymorphicAssoc = assoc => {
|
||||
return assoc.nature.toLowerCase().indexOf('morph') !== -1;
|
||||
};
|
||||
|
||||
module.exports = ({ models, target, plugin = false }, ctx) => {
|
||||
const { instance } = ctx;
|
||||
|
||||
@ -117,7 +121,7 @@ module.exports = ({ models, target, plugin = false }, ctx) => {
|
||||
*/
|
||||
|
||||
const morphAssociations = definition.associations.filter(
|
||||
association => association.nature.toLowerCase().indexOf('morph') !== -1
|
||||
isPolymorphicAssoc
|
||||
);
|
||||
|
||||
const populateFn = createOnFetchPopulateFn({
|
||||
@ -366,6 +370,7 @@ const createOnFetchPopulateFn = ({
|
||||
|
||||
if (definition.modelType === 'component') {
|
||||
definition.associations
|
||||
.filter(assoc => !isPolymorphicAssoc(assoc))
|
||||
.filter(ast => ast.autoPopulate !== false)
|
||||
.forEach(ast => {
|
||||
this.populate({ path: ast.alias });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user