-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Deprecate undeclared entity inheritance #10431
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mpdude
force-pushed
the
catch-wrong-hierarchies
branch
from
January 19, 2023 09:09
4c59207
to
2f476f4
Compare
mpdude
changed the title
Catch missing inheritance declarations early on
Catch missing inheritance declarations early on (👀 👀 required!)
Jan 19, 2023
mpdude
changed the title
Catch missing inheritance declarations early on (👀 👀 required!)
Catch missing inheritance declarations early on
Jan 19, 2023
This was referenced Jan 19, 2023
mpdude
changed the title
Catch missing inheritance declarations early on
Deprecate undeclared entity inheritance
Jan 20, 2023
mpdude
force-pushed
the
catch-wrong-hierarchies
branch
4 times, most recently
from
January 20, 2023 23:23
118840a
to
da8601b
Compare
As always, we don't introduce deprecations in bugfix releases. Please target 2.15. |
mpdude
force-pushed
the
catch-wrong-hierarchies
branch
from
January 23, 2023 12:57
da8601b
to
7d7dc1b
Compare
Rebased onto 2.15.x, and tied a knot in my handkerchief. |
mpdude
force-pushed
the
catch-wrong-hierarchies
branch
from
January 23, 2023 12:59
7d7dc1b
to
835212f
Compare
derrabus
requested changes
Jan 24, 2023
Inheritance has to be declared as soon as one entity class extends (directly or through middle classes) another one. This is also pointed out in the opening comment for doctrine#8348: > Entities are not allowed to extend from entities without an inheritence mapping relationship (Single Table or Joined Table inheritance). [...] While Doctrine so far allowed these things, they are fragile and will break on certain scenarios. Throwing an exception in case of this misconfiguration is nothing we should do light-heartedly, given that it may surprise users in a bugfix or feature release. So, we should start with a deprecation notice and make this an exception in 3.0. The documentation is updated accordingly at doctrine#10429. Catching missing inheritance declarations early on is important to avoid weird errors further down the road, giving users a clear indication of the root cause. In case you are affected by this, please understand that although things "previously worked" for you, you have been using the ORM outside of what it was designed to do. That may have worked in simple cases, but may also have caused invalid results (wrong or missing data after hydration?) that possibly went unnoticed in subtle cases.
mpdude
force-pushed
the
catch-wrong-hierarchies
branch
from
January 24, 2023 20:51
835212f
to
384a5b4
Compare
Feedback addressed |
derrabus
approved these changes
Jan 24, 2023
Thanks! |
💪🏻 Let’s hope it will not cause too much confusion and problems for users in 2.15. Shall I create a dedicated PR to make the switch in 3.0? Requires changes to be merged up before, though. |
derrabus
added a commit
to derrabus/orm
that referenced
this pull request
Jan 26, 2023
* 2.15.x: Deprecate undeclared entity inheritance (doctrine#10431) Psalm 5.5.0 (doctrine#10445)
derrabus
added a commit
to derrabus/orm
that referenced
this pull request
Jan 26, 2023
* 2.15.x: Deprecate undeclared entity inheritance (doctrine#10431) Psalm 5.5.0 (doctrine#10445)
derrabus
added a commit
to derrabus/orm
that referenced
this pull request
Jan 26, 2023
* 2.15.x: Deprecate undeclared entity inheritance (doctrine#10431) Psalm 5.5.0 (doctrine#10445)
This was referenced Jan 26, 2023
mpdude
added a commit
to mpdude/doctrine2
that referenced
this pull request
Jan 26, 2023
In doctrine#10431, some invalid inheritance declarations in our test base were fixed. However, the change missed to update XML, PHP and static PHP mapping configurations as well. Apparently, this did not raise any flags because the misconfiguration only caused a deprecation notice in 2.15.x. Running the tests against 3.0 (where the misconfiguration will be an error) unveiled the mistake.
mpdude
added a commit
to mpdude/doctrine2
that referenced
this pull request
Jan 26, 2023
This removes comments added in doctrine#10431 on the 2.15.x branch, as suggested in doctrine#10460 (comment).
mpdude
added a commit
to mpdude/doctrine2
that referenced
this pull request
Jan 26, 2023
This removes comments added in doctrine#10431 on the 2.15.x branch, as suggested in doctrine#10460 (comment).
derrabus
pushed a commit
that referenced
this pull request
Jan 26, 2023
This removes comments added in #10431 on the 2.15.x branch, as suggested in #10460 (comment).
derrabus
pushed a commit
that referenced
this pull request
Jan 26, 2023
In #10431, some invalid inheritance declarations in our test base were fixed. However, the change missed to update XML, PHP and static PHP mapping configurations as well. Apparently, this did not raise any flags because the misconfiguration only caused a deprecation notice in 2.15.x. Running the tests against 3.0 (where the misconfiguration will be an error) unveiled the mistake.
derrabus
added a commit
to derrabus/orm
that referenced
this pull request
Jan 27, 2023
* 2.15.x: Psalm 5.6.0, PHPStan 1.9.14 (doctrine#10468) Fix some tests that were missed in doctrine#10431 (doctrine#10464) Remove commented-out code sections (doctrine#10465)
mpdude
added a commit
to mpdude/doctrine2
that referenced
this pull request
Jan 27, 2023
This follows up on doctrine#10431: This kind of misconfiguration triggered a deprecation warning since 2.15.x. Now let's make it an exception.
mpdude
added a commit
to mpdude/doctrine2
that referenced
this pull request
Jan 27, 2023
This follows up on doctrine#10431: This kind of misconfiguration triggered a deprecation warning since 2.15.x. Now let's make it an exception.
mpdude
added a commit
to mpdude/doctrine2
that referenced
this pull request
Jan 27, 2023
This follows up on doctrine#10431: This kind of misconfiguration triggered a deprecation warning since 2.15.x. Now let's make it an exception.
derrabus
pushed a commit
that referenced
this pull request
Feb 8, 2023
This follows up on #10431: This kind of misconfiguration triggered a deprecation warning since 2.15.x. Now let's make it an exception.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Inheritance has to be declared as soon as one entity class extends (directly or through middle classes) another one.
This is also pointed out in the opening comment for #8348:
Throwing an exception in case of this misconfiguration is nothing we should do light-heartedly, given that it may surprise users in a bugfix or feature release. So, we should start with a deprecation notice and make this an exception in 3.0. The documentation is updated accordingly at #10429.
Catching missing inheritance declarations early on is important to avoid weird errors further down the road, giving users a clear indication of the root cause.
In case you are affected by this, please understand that although things "previously worked" for you, you have been using the ORM outside of what it was designed to do. That may have worked in simple cases, but may also have caused invalid results (wrong or missing data after hydration?) that possibly went unnoticed in subtle cases.
Update: For one example of strange things that may happen down the road, see #3037 (comment).