Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): deprecate persist/flush/remove methods from EntityRepository #4259

Merged
merged 1 commit into from
Apr 23, 2023

Conversation

B4nan
Copy link
Member

@B4nan B4nan commented Apr 23, 2023

Both persist and flush are tied to the EM instance, we have the repository shortcuts, but they feel confusing, as they might give users false sense that they do something only with that given entity type. Maybe we should remove them and make the em getter public instead, to preserve easy access to the functionality.

In preparation for removal of those methods in v6, all the following EntityRepository methods are now deprecated:

  • persist
  • persistAndFlush
  • remove
  • removeAndFlush
  • flush

Additionally, there is a new public repo.getEntityManager() method available.

Related: #3989

…sitory`

Both persist and flush are tied to the EM instance, we have the repository shortcuts, but they
feel confusing, as they might give users false sense that they do something only with that given
entity type. Maybe we should remove them and make the em getter public instead, to preserve easy
access to the functionality.

In preparation for removal of those methods in v6, all the following `EntityRepository` methods
are now deprecated:

- persist
- persistAndFlush
- remove
- removeAndFlush
- flush

Additionally, there is a new public `repo.getEntityManager()` method available.

Related: #3989
@B4nan B4nan changed the title feat(core): deprecate persist/flush/remove methods from `EntityRepo… feat(core): deprecate persist/flush/remove methods from EntityRepository Apr 23, 2023
@codecov
Copy link

codecov bot commented Apr 23, 2023

Codecov Report

Patch coverage: 94.59% and project coverage change: -0.05 ⚠️

Comparison is base (301bdf8) 99.70% compared to head (1b88df0) 99.65%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4259      +/-   ##
==========================================
- Coverage   99.70%   99.65%   -0.05%     
==========================================
  Files         214      214              
  Lines       14026    14032       +6     
  Branches     3296     3296              
==========================================
  Hits        13984    13984              
- Misses         41       47       +6     
  Partials        1        1              
Impacted Files Coverage Δ
packages/knex/src/SqlEntityRepository.ts 86.66% <80.00%> (-13.34%) ⬇️
packages/mongodb/src/MongoEntityRepository.ts 84.61% <80.00%> (-15.39%) ⬇️
packages/core/src/entity/EntityRepository.ts 97.10% <100.00%> (-2.90%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@B4nan B4nan merged commit eba4563 into master Apr 23, 2023
@B4nan B4nan deleted the repo-methods-deprecate branch April 23, 2023 10:15
jsprw pushed a commit to jsprw/mikro-orm-full-text-operators that referenced this pull request May 7, 2023
…sitory` (mikro-orm#4259)

Both persist and flush are tied to the EM instance, we have the
repository shortcuts, but they feel confusing, as they might give users
false sense that they do something only with that given entity type.
Maybe we should remove them and make the em getter public instead, to
preserve easy access to the functionality.

In preparation for removal of those methods in v6, all the following
`EntityRepository` methods are now deprecated:

- persist
- persistAndFlush
- remove
- removeAndFlush
- flush

Additionally, there is a new public `repo.getEntityManager()` method
available.

Related: mikro-orm#3989
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant