Page Contents

Home > @loopback/sequelize > SequelizeCrudRepository > createBelongsToAccessorFor

SequelizeCrudRepository.createBelongsToAccessorFor() method

Function to create a belongs to accessor

Signature:

protected createBelongsToAccessorFor<Target extends Entity, TargetId>(relationName: string, targetRepositoryGetter: Getter<EntityCrudRepository<Target, TargetId>> | {
        [repoType: string]: Getter<EntityCrudRepository<Target, TargetId>>;
    }): BelongsToAccessor<Target, ID>;

Parameters

Parameter Type Description
relationName string Name of the relation defined on the source model
targetRepositoryGetter Getter<EntityCrudRepository<Target, TargetId>> | { [repoType: string]: Getter<EntityCrudRepository<Target, TargetId>>; }  

Returns:

BelongsToAccessor<Target, ID>