Skip to content

Allow doctrine/orm:^3 - #47

Merged
janlam7 merged 5 commits into
hostnet:masterfrom
janlam7:orm-upgrade
Oct 19, 2026
Merged

janlam7 merged 5 commits into
hostnet:masterfrom
janlam7:orm-upgrade

Conversation

@janlam7

@janlam7 janlam7 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor
  • Support doctrine/orm ^3.0 too
  • Ensure both doctrine/orm major versions get tested explicitly

janlam7 and others added 4 commits October 14, 2026 14:53
Code changes needed for ORM 3, verified to keep working on ORM 2.19.7+
as well by running the full suite against both:
- Doctrine\ORM\Mapping\ClassMetadataInfo is removed entirely in ORM 3;
  its ONE_TO_ONE/TO_MANY constants now live directly on ClassMetadata.
- ORM 3's now-default native lazy objects are plain instances of the
  entity's own class, not a generated proxy subclass implementing
  Doctrine\Persistence\Proxy, so `$entity instanceof Proxy` silently
  stops detecting uninitialized entities. Replaced with
  UnitOfWork::isUninitializedObject(), which exists on both ORM 2.19.7+
  and ORM 3 and is the mechanism ORM 3 itself uses internally.

Also declare doctrine/dbal and doctrine/collections directly, since
EntityMutationMetadataProvider/EntityChangedEvent use their classes
(DriverManager in tests, ArrayCollection/Collection) directly rather
than only transitively through doctrine/orm.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
phpcs is doctrine/orm-version-independent, so running it once per
matrix cell was pure duplicate work. composer.lock is gitignored here
and never checked out in CI, so hashFiles('**/composer.lock') always
evaluated to empty and the cache key never actually varied with
dependency changes; composer.json is the file that's actually present
and signals when the resolved graph might differ.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@janlam7 janlam7 self-assigned this Oct 14, 2026
janlam7 added a commit to janlam7/entity-tracker-component that referenced this pull request Oct 14, 2026
PHP 8.4 + doctrine/orm ^3 failed in CI (job 115870862309 on PR hostnet#47):
Doctrine\ORM\ORMInvalidArgumentException: Symfony LazyGhost is not
available. Please install the "symfony/var-exporter" package version
6.4 or 7 to use this feature or enable PHP 8.4 native lazy objects.

Reproduced locally: on PHP 8.4, composer resolves symfony/var-exporter
to 8.x (which removed the LazyGhostTrait-based proxy generation ORM 3
falls back to by default), while on PHP 8.3 it stays below 8.0, which
is why only the PHP 8.4 / ORM 3 matrix cell failed. ORM 3's
Configuration::isNativeLazyObjectsEnabled() defaults to false and has
to be explicitly enabled to use PHP 8.4's native lazy objects instead
of the var-exporter-based fallback; guarded with method_exists()
since ORM 2's Configuration doesn't have this method at all.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
janlam7 added a commit to janlam7/entity-tracker-component that referenced this pull request Oct 14, 2026
PHP 8.4 + doctrine/orm ^3 failed in CI (job 115870862309 on PR hostnet#47):
Doctrine\ORM\ORMInvalidArgumentException: Symfony LazyGhost is not
available. Please install the "symfony/var-exporter" package version
6.4 or 7 to use this feature or enable PHP 8.4 native lazy objects.

ORM 3's ProxyFactory defaults to generating a proxy subclass via
symfony/var-exporter's LazyGhostTrait (the same
Doctrine\Persistence\Proxy-implementing shape ORM 2 has always used),
unless Configuration::isNativeLazyObjectsEnabled() is explicitly
turned on. On PHP 8.4, composer resolves symfony/var-exporter to 8.x,
which removed that trait entirely; on PHP 8.3 it stays below 8.0,
which is why only the PHP 8.4 / ORM 3 matrix cell failed.

Pinning symfony/var-exporter (a transitive, test-only dependency here)
to ^6.3.9|^7.0 keeps every matrix cell on the long-standing generated-
proxy mechanism rather than opting into ORM 3's native lazy objects,
which would be a real behavioral change (lazy-loaded entities become
plain instances of their own class instead of a Proxy-implementing
subclass) better evaluated deliberately than as an incidental CI fix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@janlam7
janlam7 force-pushed the orm-upgrade branch 3 times, most recently from 1d0529d to 63facb8 Compare October 14, 2026 13:25
ORM 3's ProxyFactory defaults to generating a proxy subclass via
symfony/var-exporter's LazyGhostTrait (the same
Doctrine\Persistence\Proxy-implementing shape ORM 2 has always used),
unless Configuration::isNativeLazyObjectsEnabled() is explicitly
turned on. On PHP 8.4, composer resolves symfony/var-exporter to 8.x,
which removed that trait entirely; on PHP 8.3 it stays below 8.0,
which is why only the PHP 8.4 / ORM 3 matrix cell failed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@janlam7
janlam7 merged commit 97a8860 into hostnet:master Oct 19, 2026
5 checks passed
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.

2 participants