doctrine/DoctrineBundle
61.3
Adequate · 17 November 2026
5.8k
lines of production code
PHP
primary language
5
measurements over time
What this system is
Features
Custom ID generator support and entity listener service resolution
The mapping layer now supports custom ID generators and resolves entity listeners via the service container. A new MappingDriver wraps the existing driver to inject custom ID generator instances from a service locator into metadata, enabling the use of custom generators defined as services. Additionally, a new ClassMetadataFactory handles the final setup of custom ID generators after metadata loading, and a ContainerEntityListenerResolver implements a new EntityListenerServiceResolver interface to resolve entity listeners from the service container rather than instantiating them directly.
src/Mapping · high confidence
Enhanced Doctrine data collection with entity validation and cache statistics
The DoctrineDataCollector now collects detailed entity metadata (class names, file paths, line numbers) and validates entity schemas during request collection, exposing validation errors in the debug toolbar. It also aggregates second-level cache statistics, including hit/miss/put counts and per-region metrics, providing deeper insight into cache performance and entity state management.
src/DataCollector · high confidence
New Doctrine database profiler templates with query grouping and cache metrics
The profiler now includes dedicated templates for the Doctrine database collector, introducing a modern UI that displays query counts, execution times, and invalid entity warnings in the toolbar. The main panel provides detailed metrics including managed entities and second-level cache statistics (hits, misses, puts) when enabled. A key behavioral change is that large numbers of queries are grouped by default (triggered when query count exceeds 100), with an option to view all individual queries, improving performance and readability for applications with high database activity.
templates · high confidence
New PHP attributes for autoconfiguring Doctrine services
The bundle now provides four new PHP attributes in the \Doctrine\\Bundle\\DoctrineBundle\\Attribute\ namespace to simplify service configuration: \AsDbalType\ for registering custom DBAL types, \AsDoctrineListener\ for autoconfiguring DBAL event listeners, \AsEntityListener\ for autoconfiguring ORM entity listeners, and \AsMiddleware\ for registering DBAL middlewares. These attributes allow developers to annotate their classes directly, reducing the need for manual XML or YAML service tag definitions. Also in this area: 1 commit (0 fixes) modifying src/Attribute.
src, src/Attribute · medium confidence
New Twig extension for SQL query formatting and parameter replacement
A new \DoctrineExtension\ class has been added to the \src/Twig\ directory, introducing three new Twig filters: \doctrine\_prettify\_sql\, \doctrine\_format\_sql\, and \doctrine\_replace\_query\_parameters\. The \doctrine\_replace\_query\_parameters\ filter allows users to replace placeholders in SQL queries with escaped values, supporting both sequential numeric keys and named parameters, while the formatting filters provide SQL syntax highlighting and prettification using Doctrine's SQL formatter.
src/Twig · high confidence
New middleware components for connection management and enhanced debugging
The middleware layer now includes \IdleConnectionMiddleware\ to manage connection lifecycles based on TTLs, \BacktraceDebugDataHolder\ to capture and expose call stacks alongside query data for deeper debugging insights, and \DebugMiddleware\ to integrate these capabilities with the Symfony Stopwatch and connection registry. A new \ConnectionNameAwareInterface\ allows these components to correctly identify and handle specific database connections.
src/Middleware · high confidence
Removals
Removal of DoctrineController class
The DoctrineController class, previously located in the DoctrineBundle, has been removed. This eliminates the built-in controller that provided methods for accessing database connections, entity managers, and creating DQL queries directly from the controller context.
Controller · high confidence
Removal of legacy Doctrine XML schema definition
The legacy \doctrine-1.0.xsd\ schema file has been removed from the configuration resources. This file previously defined the XML structure for DBAL connections and ORM entity managers using a flat, attribute-based format. Its removal indicates that the bundle no longer supports this specific version of the XML configuration schema, requiring users to migrate to the current configuration format.
Resources/config/schema · high confidence
Removal of legacy DoctrineDataCollector
The legacy DoctrineDataCollector class has been removed from the codebase. This component previously collected basic database query statistics (such as query count and SQL text) by accessing the container's DBAL logger service and displaying them in the profiler. Its removal indicates a shift away from this specific data collection mechanism, likely in favor of more modern profiling middleware or integration points within the Symfony ecosystem.
DataCollector · high confidence
Removal of legacy DoctrineExtension class
The legacy DoctrineExtension class, which previously handled the loading of DBAL and ORM configurations via XML files and manual service definition, has been removed. This change eliminates the old configuration loading mechanism in favor of the bundle's modernized dependency injection extension, simplifying the internal structure and removing deprecated code paths.
DependencyInjection · high confidence
Removed DbalLogger from DoctrineBundle
The DbalLogger class, previously located in the DoctrineBundle namespace, has been removed. This class extended DebugStack to log SQL queries and parameters via a provided LoggerInterface, using var\_export for parameter formatting. Its removal indicates that this specific logging implementation is no longer part of the framework's standard distribution.
Logger · high confidence
Removed deprecated Doctrine console commands
The DoctrineBundle has removed a large set of legacy console commands, including \doctrine:cache:clear-metadata\, \doctrine:cache:clear-query\, \doctrine:cache:clear-result\, \doctrine:database:create\, \doctrine:database:drop\, \doctrine:schema:create\, \doctrine:schema:drop\, \doctrine:ensure-production-settings\, \doctrine:generate:entities\, \doctrine:generate:entity\, \doctrine:generate:proxies\, \doctrine:generate:repositories\, \doctrine:mapping:convert\, \doctrine:mapping:import\, \doctrine:mapping:convert-d1-schema\, and \doctrine:data:load\. These commands are no longer available in the application, requiring users to migrate to alternative tools or external bundles for these database and entity management tasks.
Command · high confidence
Behavioural changes
Cache warmer is now internal and uses modern PHP features
The DoctrineMetadataCacheWarmer class has been marked as internal (@internal) and is no longer intended for direct use by application code. It now extends AbstractPhpFileCacheWarmer, utilizes strict types, and employs constructor property promotion for cleaner instantiation. The warmer checks if the cache file already exists before proceeding and ensures metadata is loaded before warming.
src/CacheWarmer · high confidence
Configuration system rewritten for Doctrine Bundle v7
The bundle's configuration and extension logic have been completely rewritten to support Doctrine ORM 3.x and DBAL 4, dropping support for YAML and XML mapping formats in favor of PHP attributes. The new \Configuration.php\ and \DoctrineExtension.php\ files implement a modernized configuration tree that enforces strict typing, removes deprecated options (such as \use\_savepoints\ and \collate\ defaults), and introduces new features like native lazy object support and idle connection listeners. Users must migrate their configuration to the new structure and ensure they are using PHP 8.4+.
src/DependencyInjection · high confidence
Doctrine configuration migrated to PHP-based service definitions
The bundle's configuration files have been converted from XML to PHP, introducing new service definition files for DBAL, ORM, Messenger, and middlewares. This change modernizes the internal wiring of Doctrine services, including the registration of console commands, data collectors, and middleware, while maintaining the same external API for users.
config · high confidence
New compiler passes for schema, middleware, and listener wiring
The bundle introduces several new compiler passes in the DependencyInjection/Compiler directory to handle internal wiring of Doctrine components. CacheSchemaSubscriberPass injects Doctrine DBAL cache adapter references into the schema listener, while DbalSchemaFilterPass processes doctrine.dbal.schema\_filter tags to configure schema asset filters per connection. EntityListenerPass registers entity listeners with priority sorting and lazy-loading support, and IdGeneratorPass registers custom ID generators via a service locator. MiddlewaresPass sorts and assigns connection-specific middleware references, and RegisterDbalTypePass auto-registers DBAL types using the new AsDbalType attribute with Symfony 7.3 compatibility. Finally, RemoveLoggingMiddlewarePass and RemoveProfilerControllerPass conditionally remove unused profiler/logging services, and ServiceRepositoryCompilerPass wires repository services into the container factory.
src/DependencyInjection/Compiler · high confidence
Refactored database management commands with new base class
The database management commands (\doctrine:database:create\, \doctrine:database:drop\) have been refactored to extend a new internal \DoctrineCommand\ base class, which simplifies dependency injection by accepting the \ManagerRegistry\ directly in the constructor. This change improves code structure and type safety while preserving existing command behaviors, including support for the \--connection\ option and specific handling for PostgreSQL and SQLite platforms.
src/Command · high confidence
Repository structure and metadata reorganized for DoctrineBundle 4.0
The repository has been restructured to support the upcoming DoctrineBundle 4.0 release. This includes adding metadata files (\.doctrine-project.json\, \.symfony.bundle.yaml\) to define version branches and maintenance status, updating \.gitattributes\ and \.gitignore\ to manage exports and local artifacts, and introducing static analysis configurations (PHPStan level 8, PHPCS). Documentation has been updated to point to symfony.com, and legacy upgrade guides (2.10–3.2) have been added to document breaking changes such as the removal of ORM 2 support, YML/annotation drivers, and various deprecated configuration options.
(repo-wide) · high confidence
Simplified repository base class and container-aware factory
Users can now extend the new ServiceEntityRepository base class, which accepts a ManagerRegistry and entity class name in its constructor, enabling simpler autowiring of custom repositories. Additionally, the ContainerRepositoryFactory has been introduced to fetch custom repositories directly from the service container when available, falling back to standard instantiation if the service is not registered, thereby improving integration with dependency injection. Also in this area: 1 commit (0 fixes) modifying (repo-wide).
src/Dbal, src/Repository · low confidence
Updated Doctrine configuration schema to version 1.0
The XML configuration schema for Doctrine has been updated to version 1.0, introducing support for native PHP lazy objects via the new \enable-native-lazy-objects\ attribute on the ORM configuration. The schema also adds support for configuring identity generation preferences and the \fetch\_mode\_subselect\_batch\_size\ setting, while removing deprecated configuration nodes such as \disable\_type\_comments\, \use\_savepoints\, \report\_fields\_where\_declared\, and \override-url\.
config/schema · high confidence
Test coverage
Added functional and unit tests for DoctrineBundle components; Added test fixtures for NewXmlBundle.
Dependencies
Doctrine Bundle 2.15 updates dependencies for PHP 8.4, Symfony 8, and Doctrine ORM 3/DBAL 4
The \composer.json\ manifest has been updated to require PHP 8.4 and align with major ecosystem shifts: it now requires Doctrine DBAL ^4.0 and Doctrine ORM ^3.4.4 (with a conflict preventing ORM \<3.0 or \>=4.0), and supports Symfony 6.4, 7.0, and 8.0 components. Development dependencies have also been upgraded to PHPUnit ^12.3.10, PHPStan ^2.1.13, and doctrine/coding-standard ^14, while dropping older version constraints for Twig and other libraries.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 58.3 → 61.3 (+3.0)
- Rubric changed (rubric-2026.11.2 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 94.1 → 93.9 (-0.2)
- Architecture 88.1 → 83.6 (-4.5)
- Maturity 50.1 → 49.9 (-0.2)
- Readiness 72.5 → 72.5 (0.0)
- Security 67.4 → 69.9 (+2.5)
- Accessibility 55.7 → 67.1 (+11.4)
Resolved (8)
- ConnectionFactory.createConnection (cyclomatic 16) (src/ConnectionFactory.php)
- Duplicated block (12 lines × 2) (src/DependencyInjection/Configuration.php)
- Duplicated block (5 lines × 2) (src/DependencyInjection/Configuration.php)
- Duplicated block (7 lines × 2) (src/DependencyInjection/Configuration.php)
- Orphaned file (src/DataCollector/DoctrineDataCollector.php)
- Orphaned file (src/DependencyInjection/Compiler/RegisterDbalTypePass.php)
- Rotate the exposed credentials — git history can't be un-committed
- Secret: aws-access-token (Resources/views/Collector/db.html.twig)
New (46)
- Circular dependency (src/DoctrineBundle.php)
- Further sole-owners (lower concentration)
- Hotspot: src/DependencyInjection/DoctrineExtension.php (src/DependencyInjection/DoctrineExtension.php)
- MethodTooLong: DoctrineExtension.ormLoad (src/DependencyInjection/DoctrineExtension.php)
- Off the main sequence: src/Attribute
- Off the main sequence: src/CacheWarmer
- Off the main sequence: src/Controller
- Off the main sequence: src/DataCollector
- Off the main sequence: src/Dbal
- Off the main sequence: src/Mapping
- Off the main sequence: src/Middleware
- Off the main sequence: src/Orm
- Off the main sequence: src/PropertyInfo
- Off the main sequence: src/Twig
- Off-boarding risk: anonymized user #1
- Orphaned file (src/DependencyInjection/Compiler/MiddlewaresPass.php)
- RegisterDbalTypePass.registerInTypeRegistry (cognitive 23) (src/DependencyInjection/Compiler/RegisterDbalTypePass.php)
- Skipped (documented): testAutoDiscoverEntities (tests/DependencyInjection/DoctrineExtensionTest.php)
- Skipped (documented): testAutoDiscoverEntitiesIsEnabledWhenNoMappingIsConfigured (tests/DependencyInjection/DoctrineExtensionTest.php)
- Skipped (documented): testAutoDiscoverEntitiesStaysOff (tests/DependencyInjection/DoctrineExtensionTest.php)
- …and 26 more
Changes since last survey
- 13 commits — 12 feature/other, 1 fixes
By area
- (repo) — 6 commits
- tests/DependencyInjection — 4 commits
- (root) — 1 commit
- config/dbal.php — 1 commit
- src/DependencyInjection — 1 commit
Notable commits
- fix: Merge pull request #2350 from GromNaN/fix/dbal-types-argument-default
- change: Add configuration knob for setUseSchemaEditorApi()
- change: Default the connection factory types argument to null
- change: Keep the tests working without ORM
- change: Merge pull request #2334 from greg0ire/expose-use-dbal-api
- change: Merge pull request #2340 from doctrine/3.3.x
- change: Merge pull request #2342 from doctrine/2.19.x-merge-up-into-3.3.x_qdLGn6bz
- change: Merge pull request #2346 from GromNaN/refactor/native-lazy-objects-fixture
- change: Merge remote-tracking branch 'origin/3.4.x' into 2.19.x-merge-up-into-3.3.x_qdLGn6bz
- change: Register DBAL types in the global registry for ORM before 3.8 (#2313)
- change: Remove stale PHPStan ignores
- change: Update branch metadata after the 3.4.0 release (#2345)
- change: Use the dedicated fixture in the native lazy objects test
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
doctrine/DoctrineBundle 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 17 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 467740778a47d0bb9833dd94ee5d4e5151f7c70f — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.85+preprod-eba6548ac50f.