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

Refactor code duplication in load, loadBy and loadAny() #51

Closed
romaninsh opened this issue Jul 15, 2016 · 0 comments
Closed

Refactor code duplication in load, loadBy and loadAny() #51

romaninsh opened this issue Jul 15, 2016 · 0 comments
Assignees
Milestone

Comments

@romaninsh
Copy link
Member

i need to refactor load(), loadBy() and loadAny() to merge them with tryLoad, tryLoadBy an tryLoadAny. But there are some considerations:

  • tryLoad must throw and discard exception if the record is not found. It's CPU-expensive operation.
  • exception from load() must include Query as it currently does
  • tryLoad() failure should cause model to unload()
  • load() should throw exception but not unload the model.

Given these conditions, I'm not sure who should call what. I'm thinking there should be an extra argument to Persistence->loadX that will indicate if the exception should be generated or if [] should be simply returned.

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

No branches or pull requests

2 participants