Page Contents

Home > @loopback/sequelize > SequelizeCrudRepository > includeReferencesIfRequested

SequelizeCrudRepository.includeReferencesIfRequested() method

Include related entities of @referencesMany relation

referencesMany relation is NOT handled by sequelizeModel.findAll as it doesn’t have any direct alternative to it, so to include relation data of referencesMany, we’re manually fetching related data requested


protected includeReferencesIfRequested(parentEntities: Model<T, T>[], parentEntityClass: typeof Entity, inclusionFilters?: InclusionFilter[]): Promise<(T & Relations)[]>;


Parameter Type Description
parentEntities Model<T, T>[] source table data
parentEntityClass typeof Entity loopback entity class for the parent entity
inclusionFilters InclusionFilter[] (Optional)


Promise<(T & Relations)[]>

entities with related models in them