-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Closed
Description
Issue type:
[ ] question
[ ] bug report
[x] feature request
[ ] documentation issue
To define table relations using decorators, this is the current way:
Photo.ts
@ManyToOne(type => User, user => user.photos)
user: User;User.ts
@OneToMany(type => Photo, photo => photo.user)
photos: Photo[];This works fine on Node.js, but can cause circular dependency issues on the frontend side (e.g. when using Angular CLI). See: #2059 or #1290
We could overcome those issues, if the following would be possible:
Photo.ts
@ManyToOne('User', 'photos')
user: User;User.ts
@OneToMany('Photo', 'user')
photos: Photo[];This should be fairly easy to implement, as it turns out that TypeORM already supports string instead of types (e.g. when using EntitySchema) - the only thing to do is to adjust the typeFunction type of the decorator functions.
@pleerock If that feature would be ok I could post a PR :)
mikelhamer, vinoMamba, audwinoyong, narcisbugeag, chinchaun and 9 morephatyh, chriszrc, DJEDAINI, audwinoyong, narcisbugeag and 3 morenotHaiLuu, jasperkuperus, SantiagoSchez, JosephYeoh, FrankFang and 16 more
Metadata
Metadata
Assignees
Labels
No labels