Skip to content

Merge release 3.8.0 into 4.0.x - #12789

Merged
greg0ire merged 201 commits into
4.0.xfrom
3.8.x-merge-up-into-4.0.x_fxYTU5gw
Nov 14, 2026
Merged

greg0ire merged 201 commits into
4.0.xfrom
3.8.x-merge-up-into-4.0.x_fxYTU5gw

Conversation

@github-actions

@github-actions github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Release Notes for 3.8.0

3.8.0

  • Total issues resolved: 2
  • Total pull requests resolved: 24
  • Total contributors: 8

Test Suite

Deprecation

Improvement

New Feature

BC Break

Bug

CI

BC Break

savinmikhail and others added 30 commits June 19, 2026 00:32
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.
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
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
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
beberlei and others added 19 commits November 7, 2026 11:59
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>
…-to-many

Addresses review feedback on #11107 and #7239.

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>
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
@GromNaN GromNaN self-assigned this Nov 14, 2026
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.
@GromNaN

GromNaN commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

The conflicts are resolved in merge commit 097fab9, which merges 4.0.x into this branch. No conflict markers remain.

What was done:

A follow-up commit 640fdd4 fixes the failures found by CI: the missing DBALConfiguration import in OrmFunctionalTestCase, the string default expression behavior, the DBAL deprecations about unnamed foreign keys during schema diffs, and the ENABLE_SCHEMA_EDITOR_API value of the deprecation job.

About the DBAL type provider: the method_exists(..., 'setTypeProvider') guards from 3.8 are kept in the tests. They check for the DBAL 4.6 API, not for DBAL 3. Version 4.0 still allows doctrine/dbal ^4.4.0, and the method does not exist on 4.4 and 4.5.

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
GromNaN requested a review from greg0ire November 14, 2026 16:32
@GromNaN
GromNaN requested review from beberlei and stof November 14, 2026 16:33
@greg0ire
greg0ire merged commit 730175d into 4.0.x Nov 14, 2026
53 checks passed
@greg0ire

Copy link
Copy Markdown
Member

Thanks @GromNaN !

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.