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: malformed query when selecting deeply nested embedded entities #9273

Conversation

gabrielkim13
Copy link
Contributor

Description of change

Fixes #9272

Update SelectQueryBuilder.buildSelect method to correctly build the property path for deeply nested embedded entities.

Previously, selecting a specific deeply nested embedded entity through the FindOptionsSelect object on the find* methods resulted in a runtime error, due to SelectQueryBuilder.buildSelect building the wrong property path for the embedded entity.

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run format to apply prettier formatting
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change (N/A)
  • The new commits follow conventions explained in CONTRIBUTING.md

@gabrielkim13
Copy link
Contributor Author

Looks like the main pipelines, which test all mainstream databases, are failing quite early due to sqlite3 package not being installed on the CI runner:

  column kinds > create date column
    1) "before all" hook for "create date column should automatically be set by a database"
    2) "after all" hook for "create date column should set a custom date when specified"


  4 passing (10s)
  2 failing

  1) column kinds > create date column
       "before all" hook for "create date column should automatically be set by a database":
     DriverPackageNotInstalledError: SQLite package has not been found installed. Try to install it: npm install sqlite3 --save
      at SqliteDriver.loadDependencies (src/driver/sqlite/SqliteDriver.ts:53:22)
      at new SqliteDriver (src/driver/sqlite/SqliteDriver.ts:5:1)
      at DriverFactory.create (src/driver/DriverFactory.ts:3:52)
      at new DataSource (src/data-source/DataSource.ts:40:52)
      at createDataSource (test/utils/test-utils.ts:372:12)
      at createTestingConnections (test/utils/test-utils.ts:385:28)
      at Context.<anonymous> (test/core/column-kinds/create-date-column/create-date-column.ts:16:28)

  2) column kinds > create date column
       "after all" hook for "create date column should set a custom date when specified":
     TypeError: Cannot read property 'map' of undefined
      at closeTestingConnections (test/utils/test-utils.ts:483:21)
      at Context.<anonymous> (test/core/column-kinds/create-date-column/create-date-column.ts:21:40)
      at processImmediate (internal/timers.js:461:21)

Anybody out there with some CI knowledge willing to take a look at this?

Thanks in advance!

@pleerock
Copy link
Member

Tests were fixed on the master branch, just merge latest master into your branch again. Thanks.

Update `SelectQueryBuilder.buildSelect` method to correctly build the property path for deeply nested embedded entities
@gabrielkim13 gabrielkim13 force-pushed the fix-select-on-deeply-nested-embedded-entities branch from bb63670 to e2ec8c0 Compare August 27, 2022 20:37
@pleerock pleerock merged commit 83f7b88 into typeorm:master Sep 19, 2022
@pleerock
Copy link
Member

Thank you for contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix select on deeply nested embedded entities, using Repository API
2 participants