---
lang: en
title: 'API docs: repository.flattentargetsofonetoonerelation'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/repository
permalink: /doc/en/lb4/apidocs.repository.flattentargetsofonetoonerelation.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/repository](./repository.md) &gt; [flattenTargetsOfOneToOneRelation](./repository.flattentargetsofonetoonerelation.md)

## flattenTargetsOfOneToOneRelation() function

Returns an array of instances. The order of arrays is based on the order of sourceIds

<b>Signature:</b>

```typescript
export declare function flattenTargetsOfOneToOneRelation<SourceWithRelations extends Entity, 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](./repository.stringkeyof.md)<!-- -->&lt;Target&gt; | name of the target key |

<b>Returns:</b>

(Target \| undefined)\[\]


