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

fix(repository): returns null if no related model instance found for HasOne relation #2500

Closed
wants to merge 3 commits into from

Conversation

shazha
Copy link
Contributor

@shazha shazha commented Feb 28, 2019

fix #2472

Checklist

👉 Read and sign the CLA (Contributor License Agreement) 👈

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

@bajtos bajtos added community-contribution bug Repository Issues related to @loopback/repository package labels Feb 28, 2019
@bajtos bajtos self-assigned this Mar 1, 2019
@bajtos
Copy link
Member

bajtos commented Mar 1, 2019

Hi @shazha, thank you for the pull request. I am afraid the current implementation is intentional and it's just the tsdoc comment that needs fixing.

You can read through the discussion in #1658 to better understand our reasoning.

I can see how it can be useful to allow hasOne relation to support optional target and return null or undefined when there is no target model associated with the source instance. Let's discuss this
#2472.

@bajtos
Copy link
Member

bajtos commented Feb 17, 2020

@shazha ping, what's the status of this pull request? Are you still keen to work on this change?

@shazha
Copy link
Contributor Author

shazha commented Mar 16, 2020

@bajtos Sorry for didn't get back to it in time. I checked the latest source code and the comment is already fixed. I figured that you could close this PR directly 😀

@dougal83
Copy link
Contributor

Closing as appears no longer relevant. Relevant source has been updated.

@dougal83 dougal83 closed this Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Repository Issues related to @loopback/repository package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DefaultHasOneRepository.get method throws exception if no match found
3 participants