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

Commit

Permalink
docs: explicitly defining the optional nature of the ManyToOne and On…
Browse files Browse the repository at this point in the history
…eToMany 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>
  • Loading branch information
2 people authored and pleerock committed Sep 13, 2019
1 parent c52b3d2 commit 644c21b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/many-to-one-one-to-many-relations.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class User {
Here we added `@OneToMany` to the `photos` property and specified the target relation type to be `Photo`.
You can omit `@JoinColumn` in a `@ManyToOne` / `@OneToMany` relation.
`@OneToMany` cannot exist without `@ManyToOne`.
If you want to use `@OneToMany`, `@ManyToOne` is required.
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.
Where you set `@ManyToOne` - its related entity will have "relation id" and foreign key.

This example will produce following tables:
Expand Down

0 comments on commit 644c21b

Please sign in to comment.