Skip to main content

Function: ManyToOne()

ManyToOne(target, inverseSideOrOptions?, options?): PropertyDecorator

Defined in: src/decorators/ManyToOne.ts:14

Property decorator establishing a many-to-one relationship with a parent entity. Supports both TypeORM style @ManyToOne(() => User, u => u.posts, { foreignKey: 'userId' }) and EntityTS style @ManyToOne(() => User, 'userId').

Parameters​

ParameterType
target() => Function
inverseSideOrOptions?string | ManyToOneOptions | ((object) => any)
options?ManyToOneOptions

Returns​

PropertyDecorator