use the new method to generate the collection name

This commit is contained in:
Kamal Bennani 2018-09-14 00:24:07 +02:00
parent 3593046c41
commit e5ce8c1b42
No known key found for this signature in database
GPG Key ID: 4513063CDB1A1C25

View File

@ -502,7 +502,7 @@ module.exports = function(strapi) {
console.log(e);
}
strapi.log.warn(`The SQL database indexes haven't been generated successfully. Please enable the debug mode for more details.`);
strapi.log.warn('The SQL database indexes haven\'t been generated successfully. Please enable the debug mode for more details.');
}
}
};
@ -677,24 +677,11 @@ module.exports = function(strapi) {
}
};
const table = _.get(manyRelations, 'collectionName') ||
_.map(
_.sortBy(
[
collection.attributes[
manyRelations.via
],
manyRelations
],
'collection'
),
table => {
return _.snakeCase(
// eslint-disable-next-line prefer-template
pluralize.plural(table.collection) + ' ' + pluralize.plural(table.via)
);
}
).join('__');
const table = _.get(manyRelations, 'collectionName')
|| utilsModels.getCollectionName(
collection.attributes[manyRelations.via],
manyRelations
);
await handler(table, attributes);
}
@ -813,24 +800,11 @@ module.exports = function(strapi) {
strapi.plugins[details.plugin].models[details.collection]:
strapi.models[details.collection];
const collectionName = _.get(details, 'collectionName') ||
_.map(
_.sortBy(
[
collection.attributes[
details.via
],
details
],
'collection'
),
table => {
return _.snakeCase(
// eslint-disable-next-line prefer-template
pluralize.plural(table.collection) + ' ' + pluralize.plural(table.via)
);
}
).join('__');
const collectionName = _.get(details, 'collectionName')
|| utilsModels.getCollectionName(
collection.attributes[details.via],
details,
);
const relationship = _.clone(
collection.attributes[details.via]