Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(mapping): support mixed M:N with composite PK on one side only
When populating m:n relation in some cases was error, where wrong metadata used to check is there composite PK involved in query, which caused some cryptic errors.
- Loading branch information
Showing
9 changed files
with
177 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Collection, Entity, ManyToMany, PrimaryKey, Property } from '@mikro-orm/core'; | ||
import { User2 } from './User2'; | ||
|
||
@Entity() | ||
export class Sandwich { | ||
|
||
@PrimaryKey() | ||
id!: number; | ||
|
||
@Property({ length: 255 }) | ||
name: string; | ||
|
||
@Property() | ||
price: number; | ||
|
||
@ManyToMany(() => User2, u => u.sandwiches) | ||
users: Collection<User2> = new Collection<User2>(this); | ||
|
||
constructor(name: string, price: number) { | ||
this.name = name; | ||
this.price = price; | ||
} | ||
|
||
} |
Oops, something went wrong.