Page Contents

Home > @loopback/repository > includeRelatedModels

includeRelatedModels() function

Returns model instances that include related models that have a registered resolver.

Signature:

export declare function includeRelatedModels<T extends Entity, Relations extends object = {}>(targetRepository: EntityCrudRepository<T, unknown, Relations>, entities: T[], include?: Inclusion<T>[], options?: Options): Promise<(T & Relations)[]>;

Parameters

Parameter Type Description
targetRepository EntityCrudRepository<T, unknown, Relations> The target repository where the model instances are found
entities T[] An array of entity instances or data
include Inclusion<T>[] Inclusion filter
options Options Options for the operations

Returns:

Promise<(T & Relations)[]>