Repository navigation
Merge release 3.8.0 into 4.0.x - #12789
Merged
Merged
Conversation
This fixes a hydration error ("Undefined array key") when loading a
collection indexed by an inherited field after the SQL filters
changed. The column alias reuse from #11792/#12373 stores the alias
under the field's declaring class but looks it up under the alias's
class, so it never matches for inherited fields.
Fixes #12505
…alias Fix hydration of collections indexed by an inherited field when SQL filters change
…s-3.6.x [GH-12403] Fix stale original-data tracking for native lazy objects
Merge 3.6.x up into 3.7.x
3.7.0 has been released. As a consequence: - 3.8.x is the next minor branch; - 3.7.x is the current branch; - 3.6.x is no longer maintained.
These 3 versions have less than 2k daily downloads.
Update branch metadata
This was introduced in d4dc768. 3.6 supports having an STI hierarchy where multiple child entities use the same join column for associations that target different entities. SchemaTool does not create foreign keys because they would conflict, and creates an index instead, and that index must be added only once.
In 6af7de3, I removed redundant EventManager::hasListeners() checks. In parallel to that, I did a change on 3.6.x to the same piece of code to replace the schema instance. Then, during a merge up, I kept both branches of the conflict.
I had to relax a test that checked for the name of an index, which we do not really care about. What we really care about is that there is an index on the column named `quoted-name`. The name changes because the quoting changed from `quoted-name` to "quoted-name".
…-docs Update documentation for SchemaTool DROP_DATABASE / dropDatabase
Migrate call to IndexEditor API
Ensure ToolEvents::postGenerateSchema is called once
Avoid creating duplicate index for conflicting STI associations
…wSkAi Merge release 3.7.1 into 3.8.x
testHydrateAllClearsAllAttachedListenersEvenOnError, the regression test for #8482, asserts after hydrateAll(), which is the call it expects to throw, so neither assertion ran: inverting both of them kept the test green. A try/finally restores the error path the test is named for. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011M5uTyCU4WcNTsPvGrErDo
Repository methods must keep accepting 'asc'/'desc' strings without a deprecation because the ObjectRepository interface of doctrine/persistence 3.x and 4.x documents strings as the only order values. As an implementer, EntityRepository can still widen its documented parameter type, so \SortDirection is now accepted and documented there as well. This makes the new SortDirection guidance usable on the most common repository API. The persister interface load() is aligned to the same widened type. Add functional tests (with and without second level cache), static analysis coverage, and clarify the deprecation scope in UPGRADE.md and the reference docs.
Address review feedback on #12613: - drop the ambiguous "assumed" and the PHPStan-specific argument.type identifier; reword the BC break to match the QueryBuilder wording - note that doctrine/persistence 5.0 will accept SortDirection in ObjectRepository
…ions Run the error-path assertions in AbstractHydratorTest
PHPStan 2.2.14
Merge 3.7.x up into 3.8.x
Allow `SortDirection` in `EntityRepository::findBy()` and `findOneBy()`
When two child entities in a single table inheritance hierarchy define an association using the same join column and target the same entity, but declare different JoinColumn configuration (for example, a different nullable, onDelete, or deferrable value), SchemaTool 3.7.0 silently omitted the foreign key constraint for that column instead of generating it, leaving a column that looks like a foreign key without any referential integrity constraint backing it. This was introduced by GH-12528, which added logic to detect conflicting foreign keys for a shared join column and fall back to a plain index instead of a constraint. That fallback is correct when the two associations target different tables (see GH-12606 / GH-12607, where an index is the only option, since no single FK could ever represent that mapping), but it was also applied when both associations target the same table and columns and only their column-level options differ. In that case there is no single foreign key definition that could satisfy both associations, but a foreign key using one of the two configurations is still strictly better than no foreign key at all. Restore a foreign key for this case: when a composite key already has registered FK metadata that targets the same foreign table and columns, keep sharing that foreign key instead of blacklisting it, regardless of whether the JoinColumn options match exactly. The association registered first keeps "winning", exactly as ORM behaved before GH-12528. Associations that target a genuinely different table/columns are unaffected and keep falling back to a plain index, which is now still added at most once per composite key. Fixes #12609
Fixes #8608 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes #11942 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes #5613 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Addresses review feedback on #7480. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Documentation fixes for triaged issues
It was deprecated in doctrine/collections#562
The SQL of a select expression whose function implements ExpressionWithReturnType is wrapped with the convertToPHPValueSQL() method of the declared type, like the SQL selecting a column of this type, so that the hydrator receives the value in the format it converts: for instance, a function returning a geometry is selected as the geometry type expects. The built-in types do not modify the SQL, and the results selected as HIDDEN are not converted.
This should avoid confusions with other APIs.
Rename "DBAL editor API" concept
It is exposed in the bundle, there no longer is a reason not to use it.
Deprecate not using the schema editor API
Defer postLoad until the outermost hydration has finished
# Conflicts: # docs/en/cookbook/working-with-datetime.rst # src/Internal/Hydration/AbstractHydrator.php # src/Internal/Hydration/SimpleObjectHydrator.php
Merge 3.7.x up into 3.8.x
Convert the results of functions declaring their return type
The SQL generation tests and other unit tests registered their custom DBAL types in the global registry. DBAL 4.6 deprecates the static methods of Type and resolves types through the type provider of the connection, so these tests fail the deprecation CI job. Move registerDbalType() and getTypeRegistry() from OrmFunctionalTestCase to OrmTestCase, inject the shared registry in the connections created by the unit tests, and discard the registry between tests so that registered types do not leak.
…-registry Register test DBAL types in the shared type registry
Resolve conflicts by keeping the 4.0 removals and porting the 3.8 changes to the 4.0 API: - Keep the files removed in 4.0.x removed (DatabaseDriver, legacy Paginator, NotSupported, DatabaseDriver tests, DBAL 3 phpstan config). - Port the schema editor API rename to setUseSchemaEditorApi() and the ENABLE_SCHEMA_EDITOR_API environment variable, with the deprecation for disabling it. - Require the doctrine/orm-plugin-second-level-cache package when enabling the second level cache, and add it to composer.json. - Keep the new hydrator API (hydrateRow, gatherRow) and the by-reference compatibility path required by 4.0 hydrator subclasses. - Port the UnitOfWork change detection by database value and the stale partial-load tracking fix, without the native lazy objects config checks that 4.0 dropped. - Port the cursor pagination fixes and the lazy total count of OffsetPaginator and WindowPage onto the 4.0 classes. - Adapt ExperimentalSchemaTool to Doctrine\ORM\Tools\Exception\NotSupported. - Register the test DBAL types in the shared type registry, keeping the guards for DBAL 4.5, where Configuration::setTypeProvider() does not exist yet. - Adapt the GH7039 test to OffsetPaginator, and keep the 4.0 versions of the SortDirection-related tests that 4.0 rewrote. - Regenerate the phpstan baseline for the merged code and ignore the TypeProvider class, which only exists in DBAL >= 4.6.
Member
|
The conflicts are resolved in merge commit 097fab9, which merges What was done:
A follow-up commit 640fdd4 fixes the failures found by CI: the missing About the DBAL type provider: the |
Add the missing DBALConfiguration import in OrmFunctionalTestCase. Restore the 4.0 LogicException for string default expressions in SchemaTool and ExperimentalSchemaTool, and restore the 4.0 tests. Ignore the DBAL deprecations about unnamed foreign keys during schema diffs. Run the deprecation job with the schema editor API enabled.
GromNaN
approved these changes
Nov 14, 2026
greg0ire
approved these changes
Nov 14, 2026
Member
|
Thanks @GromNaN ! |
This file contains hidden or 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
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.
Release Notes for 3.8.0
3.8.0
Test Suite
Deprecation
Improvement
Column::getType()by settingtypeNamethanks to @GromNaNNew Feature
BC Break
Bug
CI
BC Break
findBy()/findOneBy()phpdoc doesn't allowSortDirectionfor$orderBythanks to @talhaamir2024SortDirectioninEntityRepository::findBy()andfindOneBy()thanks to @GromNaN