mirror of
				https://github.com/strapi/strapi.git
				synced 2025-11-04 03:43:34 +00:00 
			
		
		
		
	use the new method to generate the collection name
This commit is contained in:
		
							parent
							
								
									3593046c41
								
							
						
					
					
						commit
						e5ce8c1b42
					
				@ -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
 | 
			
		||||
                            ],
 | 
			
		||||
                    const table = _.get(manyRelations, 'collectionName')
 | 
			
		||||
                      || utilsModels.getCollectionName(
 | 
			
		||||
                        collection.attributes[manyRelations.via],
 | 
			
		||||
                        manyRelations
 | 
			
		||||
                          ],
 | 
			
		||||
                          'collection'
 | 
			
		||||
                        ),
 | 
			
		||||
                        table => {
 | 
			
		||||
                          return _.snakeCase(
 | 
			
		||||
                            // eslint-disable-next-line prefer-template
 | 
			
		||||
                            pluralize.plural(table.collection) + ' ' + pluralize.plural(table.via)
 | 
			
		||||
                      );
 | 
			
		||||
                        }
 | 
			
		||||
                      ).join('__');
 | 
			
		||||
 | 
			
		||||
                    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)
 | 
			
		||||
                  const collectionName = _.get(details, 'collectionName')
 | 
			
		||||
                    || utilsModels.getCollectionName(
 | 
			
		||||
                      collection.attributes[details.via],
 | 
			
		||||
                      details,
 | 
			
		||||
                    );
 | 
			
		||||
                      }
 | 
			
		||||
                    ).join('__');
 | 
			
		||||
 | 
			
		||||
                  const relationship = _.clone(
 | 
			
		||||
                    collection.attributes[details.via]
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user