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

Fixed deprecated relatedTableAlias from Objection.js #43

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/FindQueryBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ class FindQueryBuilder {
builder.allowEager(this._allowEager);
}

builder.eager(eager.value);
builder.withGraphFetched(eager.value);
}

_parsePropertyRefs(refs) {
Expand Down
6 changes: 4 additions & 2 deletions lib/PropertyRef.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ class PropertyRef {
const builder = this.modelClass.query();
// one-to-one relations are joined and the joined table is given an alias.
// We must refer to the column through that alias.
return this.relation.relatedTableAlias(builder) + '.' + this.columnName;
return (
builder.tableRefFor(this.relation.relatedModelClass.getTableName()) + '.' + this.columnName
);
} else {
return this.modelClass.tableName + '.' + this.columnName;
}
Expand Down Expand Up @@ -137,7 +139,7 @@ class PropertyRef {
});
subQuery[whereMethod].apply(subQuery, filter.args);

builder.whereExists(subQuery.build().select(1));
builder.whereExists(subQuery.toKnexQuery().select(1));
} else {
builder[whereMethod].apply(builder, filter.args);
}
Expand Down
Loading