Page Contents

Home > @loopback/repository > flattenTargetsOfOneToManyRelation

flattenTargetsOfOneToManyRelation() function

Returns an array of instances. The order of arrays is based on as a result of one to many relation. The order of arrays is based on the order of sourceIds

Signature:

export declare function flattenTargetsOfOneToManyRelation<Target extends Entity>(sourceIds: unknown[], targetEntities: Target[], targetKey: StringKeyOf<Target>): (Target[] | undefined)[];

Parameters

Parameter Type Description
sourceIds unknown[] One value or array of values of the target key
targetEntities Target[] target entities that satisfy targetKey’s value (ids).
targetKey StringKeyOf<Target> name of the target key

Returns:

(Target[] | undefined)[]