Doctrine 1 → 3

Doctrine Upgrade Service: from Doctrine ORM 1 or 2 to Doctrine 3

Doctrine ORM 3 and DBAL 4 removed annotations, the old query APIs and a long list of deprecated methods. Rector has dedicated Doctrine sets for exactly these changes, so most of the upgrade is a diff your team reviews in an afternoon.

Typical blockers

What stops a Doctrine upgrade

  • Annotation mapping that Doctrine ORM 3 no longer reads, needs PHP 8 attributes
  • Repositories extending EntityRepository and entities coupled to the ORM lifecycle
  • Removed DBAL methods: fetchAll(), executeUpdate(), Statement::execute()
  • Doctrine 1 or early Doctrine 2 patterns with no migration path in the official upgrade guides
How we do it

Step by step, always mergeable

  1. Intro analysis: we count entities, mapping formats and DBAL calls and tell you what the upgrade costs before you commit.
  2. Convert annotations to attributes and decouple repository inheritance to composition with Rector Doctrine sets.
  3. Replace removed DBAL and ORM APIs, then bump Doctrine one major at a time with tests green after each bump.
  4. Leave the project on Doctrine ORM 3 with Rector and PHPStan Doctrine extension in CI.

What the diff looks like

Every change is a reviewable diff, small enough to merge the same day.

doctrine-upgrade.diff
-/**
- * @ORM\Entity(repositoryClass="App\Repository\OrderRepository")
- */
-class Order
-{
- /**
- * @ORM\Column(type="string", length=20)
- */
- private $status;
-}
+#[ORM\Entity(repositoryClass: OrderRepository::class)]
+class Order
+{
+ #[ORM\Column(type: 'string', length: 20)]
+ private string $status;
+}
“Thanks to Rector, we were able to quite simply refactor the core of our API, which saved a lot of work that our developers would otherwise have to do manually.”
Milan Mimra
Milan Mimra
CTO at Spaceflow
Intro analysis
2 weeks, $6,000-8,000

Codebase measured, blockers listed, timeline and price for the whole upgrade in a PDF report.

Hands-on upgrade
$120 / hour

20-80 hours a week, in parallel to your team, every change delivered as a mergeable pull request.

Do it yourself
Open source

Browse Doctrine Rector rules and read the documentation to run the upgrade with your own team.

Read more about Doctrine upgrades

Request a Doctrine upgrade estimate