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

QueryBuilder - passing an ObjectLiteral to a .where() clause, with properties from join table column raises EntityColumnNotFound exception #7226

Open
1 of 21 tasks
zivaricha opened this issue Dec 29, 2020 · 0 comments

Comments

@zivaricha
Copy link

zivaricha commented Dec 29, 2020

Issue Description

using QueryBuilder im able to:

this.myRepo.createQueryBuilder('mainAlias')
        .innerJoin('mainAlias.secondaryTable', 'secondaryAlias')
       .where(parsedParams.where)
        .orderBy(parsedParams.order)
       .getMany();
       
// parsedParams.order would look like
{
  'secondaryAlias.someAttribute': ASC 
}

and TypeORM understands the orderBy clause correctly, and orders by 'secondaryAlias.someAttribute'
when i try the same approach with the .where() clause it fails on EntityColumnNotFound.

why?

how can i use the .where(ObjectLiteral) variation and filter by a join table's attribute?

Expected Behavior

support sending an object litertal to .where() clause containing filters on not-main alias.

Actual Behavior

typeorm raises EntityColumnNotFound exception.

Steps to Reproduce

// insert code here

My Environment

Dependency Version
Operating System
Node.js version v12.20.0
Typescript version v3.9.7
TypeORM version v0.2.29

Additional Context

Relevant Database Driver(s)

  • aurora-data-api
  • aurora-data-api-pg
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

  • Yes, I have the time, and I know how to start.
  • Yes, I have the time, but I don't know how to start. I would need guidance.
  • No, I don't have the time, although I believe I could do it if I had the time...
  • No, I don't have the time and I wouldn't even know how to start.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants