feat: Change getRepositoryToken provider generation to use getEntityManagerToken instead of getConnectionToken
PR Checklist
Please check if your PR fulfills the following requirements:
- [x] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
PR Type
What kind of change does this PR introduce?
- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [x] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Other... Please describe:
What is the current behavior?
Changes the repository provider instantiation to use EntityManager instead of connection, allowing easier overriding.
Issue Number: #1819
What is the new behavior?
With this change, you can now override the EntityManager provider and retrieve repositories directly from there, allowing you to, for instance, start a transaction, and re-use that EntityManager instance for all inject points.
Does this PR introduce a breaking change?
- [x] Yes
- [ ] No
Other information
@kamilmysliwiec Can this be considered for merge?
Thanks for your contribution @edeesis! While this is a great change and step forward, I'm afraid we should postpone merging this PR till the next major release since it sorts of introduces a breaking change (may break existing projects).
Sounds good to me! No problem