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: Property metadata override does not work when extending an entity class #10896

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

titovb
Copy link

@titovb titovb commented May 19, 2024

Description of change

Fixes #10895

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
  • The new commits follow conventions explained in CONTRIBUTING.md

@titovb titovb marked this pull request as draft May 19, 2024 19:42
@titovb titovb force-pushed the master branch 2 times, most recently from c60495f to baa8f39 Compare May 19, 2024 21:21
Bohdan and others added 2 commits May 20, 2024 21:44
fix documentation
@titovb titovb marked this pull request as ready for review May 20, 2024 20:42
)
newArray.push(item)
const uniqueArray: T[] = []
const targets = Array.isArray(target) ? [...target].reverse() : [target]
Copy link
Author

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,
Copy link
Author

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.

@titovb titovb changed the title Property metadata override does not work when extending an entity class fix: Property metadata override does not work when extending an entity class May 21, 2024
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.

Property metadata override does not work when extending an entity class
1 participant