Skip to content
This repository was archived by the owner on Mar 18, 2022. It is now read-only.

Commit 644c21b

Browse files
DavidTheProgrammertobyhinloopen
authored andcommitted
docs: explicitly defining the optional nature of the ManyToOne and OneToMany relationship when viewed from the child entity (typeorm#4722)
* Update many-to-one-one-to-many-relations.md Explicitly defining the optional nature of the ManyToOne and OneToMany relationship when viewed from the child entity. * Update docs/many-to-one-one-to-many-relations.md Punctuation and more accurate semantics. Co-Authored-By: Toby Hinloopen <toby@bonaroo.nl>
1 parent c52b3d2 commit 644c21b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/many-to-one-one-to-many-relations.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class User {
4545
Here we added `@OneToMany` to the `photos` property and specified the target relation type to be `Photo`.
4646
You can omit `@JoinColumn` in a `@ManyToOne` / `@OneToMany` relation.
4747
`@OneToMany` cannot exist without `@ManyToOne`.
48-
If you want to use `@OneToMany`, `@ManyToOne` is required.
48+
If you want to use `@OneToMany`, `@ManyToOne` is required. However, the inverse is not required: If you only care about the `@ManyToOne` relationship, you can define it without having `@OneToMany` on the related entity.
4949
Where you set `@ManyToOne` - its related entity will have "relation id" and foreign key.
5050

5151
This example will produce following tables:

0 commit comments

Comments
 (0)