-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Using custom (underscored) keys for Relations : "Cannot read property 'target' of undefined" #2169
Comments
Within ReviewRepository, instead of
I used
This works for now, though not pretty. If anyone can provide an insight for making this code better, it'd be much appreciated! |
+1 there is no clear documentation to build relations. |
Please improve documentation
In code snippets source model decorated prorepty is customerId , but |
Ok, I managed documentation example to work. But I can't configure filter just to query just simple JOIN orders and its customers (( |
@JuliaRakitina I believe you are referring to #1352, which is a very important request IMO. |
Looks like the latest version of LB4 doesn't have createBelongsToAccessor() |
For me, having this in review model
and this in repository
works. Is there anything different you are trying to achieve ? |
Thank you all for chiming in. I've compiled the following criteria for this issue: Acceptance Criteria
|
Description
I am using an existing MySQL database and its schemas, and am following the tutorial to build relations.
Current Behavior
Due to the existing schema, Review has 'user_id' field that links to User's 'id.' I coded this relation in review.model.ts accordingly.
However, doing so gives me
...Cannot read property 'target' of undefined...
error whenever ReviewRepository is called.Modifying the code and its relevant parts like below does not cause any issues.
Comments
How can I keep 'user_id' as a valid field for Review? Any help is appreciated.
The text was updated successfully, but these errors were encountered: