MCPcopy Create free account
hub / github.com/loopbackio/loopback-next / hasMany

Method hasMany

packages/repository/src/model.ts:231–242  ·  view source on GitHub ↗

* Define a new hasMany relation. * @param name - The name of the hasMany relation. * @param definition - The definition of the hasMany relation.

(
    name: string,
    definition: Omit<HasManyDefinition, 'name' | 'type' | 'targetsMany'>,
  )

Source from the content-addressed store, hash-verified

229 * @param definition - The definition of the hasMany relation.
230 */
231 hasMany(
232 name: string,
233 definition: Omit<HasManyDefinition, 'name' | 'type' | 'targetsMany'>,
234 ): this {
235 const meta: HasManyDefinition = {
236 ...definition,
237 name,
238 type: RelationType.hasMany,
239 targetsMany: true,
240 };
241 return this.addRelation(meta);
242 }
243
244 /**
245 * Define a new referencesMany relation.

Callers 3

CustomerClass · 0.80
model.unit.tsFile · 0.80
getSequelizeModelMethod · 0.80

Calls 1

addRelationMethod · 0.95

Tested by

no test coverage detected