Created
January 13, 2020 11:43
-
-
Save B4nan/fb04f5827d6e1f4aef0c7682a9c12cb6 to your computer and use it in GitHub Desktop.
MikroORM 3: entity definition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Entity() | |
| export class User implements IdEntity<User> { | |
| @PrimaryKey() | |
| id!: number; | |
| @Property() | |
| name!: string; | |
| @OneToOne() | |
| address?: Address; | |
| @ManyToMany() | |
| cars = new Collection<Car>(this); | |
| constructor(name: string) { | |
| this.name = name; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment