[PR #9443] Introduce DoctrineSetup as a replacement for Setup #11616

Open
opened 2026-01-22 16:11:20 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/9443

State: closed
Merged: Yes


The Setup class is a collection of static methods for bootstrapping a ORM configuration with recommended settings. At least that's my understanding of that class. In applications where the ORM is configured through some kind of framework integration (like DoctrineBundle), that class is more or less irrelevant.

The Setup class as of today operates on Doctrine Cache instances. Since the whole ORM is now able to operate on PSR-6 we should do something about it. Unfortunately, since the Setup class is not final, altering all method signatures is quite difficult, so I decided to deprecate the whole class and add a new class named DoctrineSetup as replacement.

Key differences between the two setup classes:

  • The new class is declared final which should make future changes to that class easier.
  • It accepts PSR-6 caches instead of Doctrine Cache instances.
  • If no cache is passed and Symfony Cache is installed, a suitible cache adapter is configured, just like the old class did for Doctrine Cache.
  • The useSimpleAnnotationReader flag is not supported anymore.

Furthermore, I decided to move the newDefaultAnnotationDriver() method from the Configuration class to the new DoctrineSetup class. That method does not really mutate the configuration, it is a simple factory for the annotation driver. DoctrineSetup feels like the better place for it.

**Original Pull Request:** https://github.com/doctrine/orm/pull/9443 **State:** closed **Merged:** Yes --- The `Setup` class is a collection of static methods for bootstrapping a ORM configuration with recommended settings. At least that's my understanding of that class. In applications where the ORM is configured through some kind of framework integration (like DoctrineBundle), that class is more or less irrelevant. The `Setup` class as of today operates on Doctrine Cache instances. Since the whole ORM is now able to operate on PSR-6 we should do something about it. Unfortunately, since the `Setup` class is not final, altering all method signatures is quite difficult, so I decided to deprecate the whole class and add a new class named `DoctrineSetup` as replacement. Key differences between the two setup classes: * The new class is declared `final` which should make future changes to that class easier. * It accepts PSR-6 caches instead of Doctrine Cache instances. * If no cache is passed and Symfony Cache is installed, a suitible cache adapter is configured, just like the old class did for Doctrine Cache. * The `useSimpleAnnotationReader` flag is not supported anymore. Furthermore, I decided to move the `newDefaultAnnotationDriver()` method from the `Configuration` class to the new `DoctrineSetup` class. That method does not really mutate the configuration, it is a simple factory for the annotation driver. `DoctrineSetup` feels like the better place for it.
admin added the pull-request label 2026-01-22 16:11:20 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#11616