-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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: Property metadata override does not work when extending an entity class #10896
base: master
Are you sure you want to change the base?
Conversation
c60495f
to
baa8f39
Compare
fix documentation
fix & add tests
) | ||
newArray.push(item) | ||
const uniqueArray: T[] = [] | ||
const targets = Array.isArray(target) ? [...target].reverse() : [target] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The targets are added in the order ChildChild < Child < Base. Therefore, we need to reverse it to apply the parent columns first and override them if they were overridden by the child.
@@ -307,7 +307,6 @@ const ASchema = new EntitySchema<A>({ | |||
// specified on the 'discriminatorValue' property | |||
discriminatorValue: "my-custom-discriminator-value-for-A", | |||
columns: { | |||
...BaseSchema.options.columns, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pleerock @AlexMesser Could you verify these changes to the documentation and tests?
Correct me if I'm wrong, but the addition of BaseSchema columns is not needed because STI inheritance ensures the addition of BaseSchema columns using metadata from BaseSchema, so we don't need to override them.
Description of change
Fixes #10895
Pull-Request Checklist
master
branchnpm run format
to apply prettier formattingnpm run test
passes with this changeFixes #0000