Skip to main content

Function: OneToMany()

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

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

Property decorator establishing a one-to-many relationship with another entity. Supports both TypeORM style @OneToMany(() => Post, p => p.user, { cascade: true }) and EntityTS @OneToMany(() => Post, { foreignKey: 'userId' }).

Parameters​

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

Returns​

PropertyDecorator