John Liljegren
07/12/2023, 6:31 PM// UserProfile.cfc
function role() {
return belongsTo( "User" );
}
and I attempt to eager load the role when I query the UserProfile through a User relationship like so:
// User.cfc
function profiles() {
return hasMany("UserProfile").with("role");
}
Then if I try to call profile.getRole() (where profile is a valid profile instance loaded from the user.profiles() call) it returns undefined, and the raw SQL is showing that it passed a null value for RoleId, when I know the database has a valid RoleId. The query to get UserProfiles doesn't seem to include RoleId, which is why I assume it's failing, but why doesn't it?John Liljegren
07/12/2023, 6:42 PMelpete
07/12/2023, 7:47 PMI thought the point of the belongsTo and other relationship stuff is that you wouldn’t need to add the FK columns themselves and Quick would take care of it?That is supposed to be the case. If you can get a reproducable example up as a test case on https://github.com/coldbox-modules/quick I can take a look.
John Liljegren
07/13/2023, 2:59 PM