doctrine/persistence
65.3
Adequate · 19 September 2026
2.7k
lines of production code
PHP
primary language
1
measurement over time
What this system is
This system is the Doctrine Persistence library, which provides a standardized abstraction layer for object managers and repositories in PHP applications. It defines core interfaces for managing entity lifecycle events, metadata mapping, and proxy-based lazy loading, effectively decoupling persistence logic from specific database implementations. The library supports modern PHP features through specialized reflection utilities and offers a flexible driver system for discovering and mapping class metadata.
Features
Initial project scaffolding and configuration for Doctrine Persistence
This change establishes the foundational configuration and metadata files for the Doctrine Persistence library. It introduces the \.doctrine-project.json\ file to define version branches (including 5.0.x, 4.3.x, and 4.2.x) and documentation slugs, and sets up \.gitattributes\ and \.gitignore\ to exclude development artifacts like tests, CI configs, and lock files from distribution archives. The repository is configured with \phpstan.neon\ (level 7, PHP 8.1) and \phpunit.xml.dist\ (with deprecation tracking enabled), alongside coding standards via \phpcs.xml.dist\. Additionally, it adds the MIT \LICENSE\, a \SECURITY.md\ for vulnerability reporting, and an \UPGRADE.md\ documenting breaking changes and migration paths for versions 3.0 through 4.2.
(repo-wide) · high confidence
Introduction of Doctrine Persistence abstraction layer
This change introduces the \doctrine/persistence\ library, providing a standardized abstraction for object managers and repositories. It adds core interfaces such as \ObjectManager\, \ObjectRepository\, and \ManagerRegistry\ to define contracts for persistence operations, alongside an \AbstractManagerRegistry\ implementation. The update also includes event argument classes (e.g., \LifecycleEventArgs\, \PreUpdateEventArgs\) for lifecycle hooks and a \Proxy\ interface to support lazy loading, decoupling persistence logic from specific database implementations.
src · high confidence
New persistence mapping contracts and reflection services
This change introduces a new set of interfaces and classes in the \src/Mapping\ directory to standardize the persistence layer's mapping capabilities. It adds the \ClassMetadata\ interface defining the contract for metadata descriptors, the \ClassMetadataFactory\ interface for managing metadata loading, and the \AbstractClassMetadataFactory\ providing a base implementation with caching and lazy initialization support. Additionally, it includes a \ReflectionService\ interface along with a \RuntimeReflectionService\ implementation to handle class reflection uniformly, and a \ProxyClassNameResolver\ interface to manage proxy class names. These components provide the foundational abstractions for mapping classes to relational storage.
src/Mapping · high confidence
New reflection classes for PHP enums, proxies, and typed properties
Added three new reflection property classes to handle specific PHP scenarios: EnumReflectionProperty converts backed enum instances to/from their scalar values; RuntimeReflectionProperty avoids triggering lazy loading when accessing properties on Doctrine Proxy objects; and TypedNoDefaultReflectionProperty safely handles typed properties without default values by checking initialization status and unsetting rather than setting to null. These classes provide specialized behavior for property reflection that differs from standard PHP ReflectionProperty.
src/Reflection · high confidence
Behavioural changes
Obsolete Doctrine 1.x code samples removed from manual
The manual/codes directory has been cleared of all PHP code examples that demonstrated the legacy Doctrine 1.x API, including usage of Doctrine\_Manager, Doctrine\_Session, Doctrine\_Record, and Doctrine\_Query. These files are deleted because the documentation is being migrated to the new Doctrine\_DB architecture, rendering the old session-based and record-based code snippets obsolete.
manual/codes · high confidence
Refactored mapping drivers to support ClassLocator and colocated metadata
The mapping driver system has been restructured to decouple class discovery from file location. A new ClassLocator interface and FileClassLocator implementation allow drivers to discover classes from pre-computed lists or file iterators, enabling more efficient metadata loading. The StaticPHPDriver now supports ClassLocator for optimized class discovery, while the ColocatedMappingDriver trait provides shared logic for locating mapping files near source code. File-based drivers now use the FileLocator interface for path management, and the MappingDriverChain has been updated to work with the new driver architecture.
src/Mapping/Driver · high confidence
Test coverage
Added comprehensive test coverage for the Mapping component; Added test coverage for persistence event args, manager registry, and reflection utilities.
Dependencies
Doctrine Persistence 2.0: PHP 8.1+ requirement and dependency modernization
The Doctrine Persistence library has been updated to version 2.0, introducing a strict requirement for PHP 8.1 or higher. This release modernizes the dependency stack by allowing doctrine/event-manager versions 1 and 2, accepting all major versions of psr/cache (1.0, 2.0, and 3.0), and requiring doctrine/deprecations version 1. Development tooling has also been upgraded, with PHPStan pinned to 2.1.30, PHPUnit supporting versions 10.5.58 and 12, and the coding standard updated to version 14.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 65.
Lenses
- Code Health 99
- Architecture 100
- Maturity 48
- Readiness 72
- Security 82
Changes since last survey
- 300 commits — 277 feature/other, 23 fixes
By area
- (repo) — 153 commits
- (root) — 56 commits
- src/Persistence — 33 commits
- .github/workflows — 32 commits
- tests/Persistence — 11 commits
- src/Mapping — 6 commits
- tests/Mapping — 4 commits
- .github/dependabot.yml — 3 commits
- docs/en — 1 commit
- src/ObjectRepository.php — 1 commit
Notable commits
- fix: Backport static analysis fix
- fix: Fix CS
- fix: Fix PHPUnit warning for mocks without expectation, use stubs instead
- fix: Fix MappingDriverChain namespace matching
- fix: Fix array-key in class name list
- fix: Fix scope of scanned PHP files to not load Doctrine.Tests.Persistence.Mapping.PHPTestEntityAssert.php that asserts $metadata variable existence
- fix: Fix trimming leading backslash in RuntimeReflectionProperty
- fix: Merge pull request #329 from nicolas-grekas/fix-trim
- fix: Merge pull request #351 from yunicot/bugfix-enum-failed-reflection
- fix: Merge pull request #357 from Goazil/fix-enum-private-reflection
- fix: Merge pull request #374 from greg0ire/fix-types
- fix: Merge pull request #375 from greg0ire/fix-types-amr
- fix: Merge pull request #383 from doctrine/fix-docs
- fix: Merge pull request #396 from greg0ire/fix-badge
- fix: Merge pull request #431 from greg0ire/revert-a6cb5a
- fix: Merge pull request #448 from HypeMC/fix-namespace-matching
- fix: Merge pull request #449 from greg0ire/fix-branch-metadata
- fix: Revert "Feature: allow ColocatedMappingDriver to accept iterable source file path names"
- fix: Revert MappingDriverChain namespace matching fix (#455)
- fix: fix compatibility with PHP 8.5
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
doctrine/persistence was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 222ed758c60b01fdab8b13ef522c8968d7ea79bf — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.