---
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 | <code>unknown[]</code> | One value or array of values of the target key |
|  targetEntities | <code>Target[]</code> | target entities that satisfy targetKey's value (ids). |
|  targetKey | <code>StringKeyOf&lt;Target&gt;</code> | name of the target key |

<b>Returns:</b>

`(Target | undefined)[]`


