You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ValueTransformers are not applied when column is queried for relationships (@ManyToOne, @ManyToMany, @JoinTable) #10365
TypeORM doesn't transform values when querying a column for relationships
Expected Behavior
When a column has one or multiple transformers defined in an entity, TypeORM always transforms any values when querying the field. This should also be the case whenever a field is queried for relationships.
Actual Behavior
TypeORM omits transforming values for a column with a transformer when it's queried for determining relationships (OneToMany, ManyToMany…).
Steps to reproduce
Create an entity A in TypeORM that has a @PrimaryColumn with a transformer
Create a second entity B that has a @manytoone relationship to the first entity
Enable logging for TypeORM
Query a doc of entity B that has a relationship with A, in the log, you can see that the field is not transformed
My Environment
Dependency
Version
Operating System
macOS 13.4.1
Node.js version
18.12.1
Typescript version
4.3.5
TypeORM version
0.3.17
Additional Context
No response
Relevant Database Driver(s)
aurora-mysql
aurora-postgres
better-sqlite3
cockroachdb
cordova
expo
mongodb
mysql
nativescript
oracle
postgres
react-native
sap
spanner
sqlite
sqlite-abstract
sqljs
sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, but I don't know how to start. I would need guidance.
I've been banging my head against the code, trying to figure out where the transformation went MIA. Seriously, it's like a maze of layers, and I'm starting to think the only way out is to ditch the whole entities and go for schemas with manual transformation. Or, you know, I'm tempted to pull the plug on TypeORM altogether.
TypeORM has returned to active development after recently transitioning to new leadership (see related announcement).
As part of the new team's efforts to prioritise work on the project moving forward, it is necessary to clean up the backlog of stale issues.
🧹 This issue is being automatically closed because it has had no activity in the last 6 months.
If you believe this issue is still relevant, feel free to comment below and the maintainers may reopen it. Thank you for your contribution.
Activity
leonceaklin commentedon Sep 17, 2023
I'd like to solve this problem by adding ApplyValueTransformers to the necessary places. Would somebody like to show me how to start?
leonceaklin commentedon Oct 19, 2023
Does somebody of the maintainers have the time to help me implement this bugfix? I don't know where to start…
cs-pablorb commentedon Mar 6, 2024
We have the same issue. Where both sides of the m2m have a transformer and the save method triggers an error forcing of null value for the id.
cs-pablorb commentedon Mar 11, 2024
I've been banging my head against the code, trying to figure out where the transformation went MIA. Seriously, it's like a maze of layers, and I'm starting to think the only way out is to ditch the whole entities and go for schemas with manual transformation. Or, you know, I'm tempted to pull the plug on TypeORM altogether.
github-actions commentedon Sep 18, 2025
TypeORM has returned to active development after recently transitioning to new leadership (see related announcement).
As part of the new team's efforts to prioritise work on the project moving forward, it is necessary to clean up the backlog of stale issues.
🧹 This issue is being automatically closed because it has had no activity in the last 6 months.
If you believe this issue is still relevant, feel free to comment below and the maintainers may reopen it. Thank you for your contribution.
Frederick888 commentedon Sep 18, 2025
Please reopen. Thank you.