This repository has been archived by the owner on Oct 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 282
Use custom abstract class #288
Open
ivawzh opened this issue
Jul 19, 2020
· 3 comments
· Fixed by offsite-solutions/typeorm-model-generator#1
Open
Use custom abstract class #288
ivawzh opened this issue
Jul 19, 2020
· 3 comments
· Fixed by offsite-solutions/typeorm-model-generator#1
Labels
enhancement
new feature or bug with easy workaround
Comments
No, such functionality isn't implemented. The easiest way to achieve what you want would be to replace |
@Kononnable Thanks for the answer. |
I can mark this issue as an enhancement but I don't think it will be implemented any time soon.
|
Kononnable
added
enhancement
new feature or bug with easy workaround
and removed
question
labels
Aug 1, 2020
ivawzh
added a commit
to ivawzh/typeorm-model-generator
that referenced
this issue
Aug 10, 2020
The idea is to use the generated classes as abstract classes. Custom domain behaviors (i.e. methods, validations, and lifecycles) may be located in another class that inherits the generated model. This could benefit us from 1. avoiding polluting when running codegen after migration on existing codes. 1. have lean models without the boilerplates. 1. share common behaviors across multiple models. 3 new flags: - `extendAbstractClass` - string. Similar to `activeRecord` that `extends BaseEntity`. Now it supports custom abstract class inheritance by passing a relative path as string to `extendAbstractClass`. - `exportAbstractClass` - boolean. Export the generated models as an abstract class without `@Entity` - `skipRelationships` - boolean. Skip generating relationship columns. Because currently there is a [bug from TypeORM failing at foreign key embedded columns in abstract classes](typeorm/typeorm#3132). Close: Kononnable#288
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi, thanks for the great work!
I am wondering if it is possible to pass my own abstract class?
I am trying to implement something like ActiveModel's conventional
ApplicationRecord
. I.e. a base abstract class inherited by all entities.I'd imagine it will be something similar to the existing
activeRecord
flag, but instead of boolean, it will let me define a path to my own abstract class.E.g.
The text was updated successfully, but these errors were encountered: