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

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

[Home](./index.md) &gt; [@loopback/repository](./repository.md) &gt; [DefaultCrudRepository](./repository.defaultcrudrepository.md) &gt; [\_createBelongsToAccessorFor](./repository.defaultcrudrepository._createbelongstoaccessorfor.md)

## DefaultCrudRepository.\_createBelongsToAccessorFor() method

> Warning: This API is now obsolete.
> 
> Function to create a belongs to accessor
> 
> Use `this.createBelongsToAccessorFor()` instead
> 

<b>Signature:</b>

```typescript
protected _createBelongsToAccessorFor<Target extends Entity, TargetId>(relationName: string, targetRepoGetter: Getter<EntityCrudRepository<Target, TargetId>>): BelongsToAccessor<Target, ID>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  relationName | string | Name of the relation defined on the source model |
|  targetRepoGetter | [Getter](./context.getter.md)<!-- -->&lt;[EntityCrudRepository](./repository.entitycrudrepository.md)<!-- -->&lt;Target, TargetId&gt;&gt; |  |

<b>Returns:</b>

[BelongsToAccessor](./repository.belongstoaccessor.md)<!-- -->&lt;Target, ID&gt;


