mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #11052] Fix @SequenceGeneratorDefinition inheritance, take 2
#12777
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/doctrine/orm/pull/11052
State: closed
Merged: No
This is an alternative implementation to #11050. The difference is that with this PR here, once
@SequenceGeneratorDefinitionis used in an inheritance tree of entities and/or mapped superclasses, this definition (and in particular, the sequence name) will be inherited by all child entity/mapped superclasses.Before #10455, the rules how
@SequenceGeneratorDefinitionis inherited from parent entity/mapped superclasses were as follows:@GeneratedValue) from their parent classes@SequenceGeneratorDefinition, however, is not generally inheritedBut, this has to be considered together with the quirky mapping driver behaviour that was deprecated in #10455: The mapping driver would not report public and protected fields from mapped superclasses, so these were virtually "pushed down" to the next entity classes.
That means
@SequenceGeneratorDefinitionon mapped superclasses would, in fact, be effective as-is for inheriting entity classes. This is what was covered by the tests inBasicInheritanceMappingTestthat I marked with@group GH-10927.My guess is that this PR will make it possible to opt-in to
reportFieldsWhereDeclared(see #10455) and still get the same behaviour for mapped superclasses using@SequenceGeneratorDefinitionas before. But maybe I don't see the full picture and all edge cases, so 👀 requested.The
GH10927Testtest case validates the sequence names generated in a few cases. In fact, I wrote this test against the2.15.xbranch to make sure we get results that are consistent with the previous behaviour.