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
Embeddables: fieldName
option is ignored
#2165
Comments
I've been struggling with fixing this for quite some time unfortunately, almost got it fixed but it would break Need to move to other things now as I can't stall v5 release for one bug. Will try to get back to it later. |
Not a showstopper for me, our current |
Hello |
…ded properties This is breaking mainly for SQL drivers, where the default naming strategy is underscoring, and will now applied to the embedded properties too. You can restore to the old behaviour by implementing custom naming strategy, overriding the `propertyToColumnName` method. It now has a second boolean parameter to indicate if the property is defined inside a JSON object context. ```ts import { UnderscoreNamingStrategy } from '@mikro-orm/core'; class CustomNamingStrategy extends UnderscoreNamingStrategy { propertyToColumnName(propertyName: string, object?: boolean): string { if (object) { return propertyName; } return super.propertyToColumnName(propertyName, object); } } ``` Closes #4371 Closes #2165 Closes #2361
…ded properties (#4866) This is breaking mainly for SQL drivers, where the default naming strategy is underscoring, and will now applied to the embedded properties too. You can restore to the old behaviour by implementing custom naming strategy, overriding the `propertyToColumnName` method. It now has a second boolean parameter to indicate if the property is defined inside a JSON object context. ```ts import { UnderscoreNamingStrategy } from '@mikro-orm/core'; class CustomNamingStrategy extends UnderscoreNamingStrategy { propertyToColumnName(propertyName: string, object?: boolean): string { if (object) { return propertyName; } return super.propertyToColumnName(propertyName, object); } } ``` Closes #4371 Closes #2165 Closes #2361
Closing as fixed in v6 via #4866 |
…ded properties This is breaking mainly for SQL drivers, where the default naming strategy is underscoring, and will now applied to the embedded properties too. You can restore to the old behaviour by implementing custom naming strategy, overriding the `propertyToColumnName` method. It now has a second boolean parameter to indicate if the property is defined inside a JSON object context. ```ts import { UnderscoreNamingStrategy } from '@mikro-orm/core'; class CustomNamingStrategy extends UnderscoreNamingStrategy { propertyToColumnName(propertyName: string, object?: boolean): string { if (object) { return propertyName; } return super.propertyToColumnName(propertyName, object); } } ``` Closes #4371 Closes #2165 Closes #2361
…ded properties (#4866) This is breaking mainly for SQL drivers, where the default naming strategy is underscoring, and will now applied to the embedded properties too. You can restore to the old behaviour by implementing custom naming strategy, overriding the `propertyToColumnName` method. It now has a second boolean parameter to indicate if the property is defined inside a JSON object context. ```ts import { UnderscoreNamingStrategy } from '@mikro-orm/core'; class CustomNamingStrategy extends UnderscoreNamingStrategy { propertyToColumnName(propertyName: string, object?: boolean): string { if (object) { return propertyName; } return super.propertyToColumnName(propertyName, object); } } ``` Closes #4371 Closes #2165 Closes #2361
…ded properties (#4866) This is breaking mainly for SQL drivers, where the default naming strategy is underscoring, and will now applied to the embedded properties too. You can restore to the old behaviour by implementing custom naming strategy, overriding the `propertyToColumnName` method. It now has a second boolean parameter to indicate if the property is defined inside a JSON object context. ```ts import { UnderscoreNamingStrategy } from '@mikro-orm/core'; class CustomNamingStrategy extends UnderscoreNamingStrategy { propertyToColumnName(propertyName: string, object?: boolean): string { if (object) { return propertyName; } return super.propertyToColumnName(propertyName, object); } } ``` Closes #4371 Closes #2165 Closes #2361
…ded properties (#4866) This is breaking mainly for SQL drivers, where the default naming strategy is underscoring, and will now applied to the embedded properties too. You can restore to the old behaviour by implementing custom naming strategy, overriding the `propertyToColumnName` method. It now has a second boolean parameter to indicate if the property is defined inside a JSON object context. ```ts import { UnderscoreNamingStrategy } from '@mikro-orm/core'; class CustomNamingStrategy extends UnderscoreNamingStrategy { propertyToColumnName(propertyName: string, object?: boolean): string { if (object) { return propertyName; } return super.propertyToColumnName(propertyName, object); } } ``` Closes #4371 Closes #2165 Closes #2361
Describe the bug
Now that #1948 is implemented and merged (thank you so much 🙌) I am trying to migrate some code that was previously using
ObjectId
s to embeddables +m:1
.It seems that the
fieldName
parameter inManyToOne
is ignored.To Reproduce
Code
Also available in repro-repo here: https://github.com/edorgeville/mikro-orm-embeddable-m1-fieldName
Expected behavior
Expected relationships to be saved according to
fieldName
property. Instead, it uses the class property name.Versions
The text was updated successfully, but these errors were encountered: