typeorm icon indicating copy to clipboard operation
typeorm copied to clipboard

feat: Change getRepositoryToken provider generation to use getEntityManagerToken instead of getConnectionToken

Open edeesis opened this issue 2 years ago • 4 comments

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

edeesis avatar Nov 27 '23 19:11 edeesis

@kamilmysliwiec Can this be considered for merge?

edeesis avatar Jan 08 '24 16:01 edeesis

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).

kamilmysliwiec avatar Jan 09 '24 07:01 kamilmysliwiec

Sounds good to me! No problem

edeesis avatar Jan 09 '24 13:01 edeesis