PHPackages                             alengo/doctrine-compatibility-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. alengo/doctrine-compatibility-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

alengo/doctrine-compatibility-bundle
====================================

Compatibility fixes for Sulu 3 with Doctrine ORM 3.x and Gedmo DoctrineExtensions

1.0.1(3mo ago)04↑2150%MITPHPPHP ^8.2

Since Apr 5Pushed 3mo agoCompare

[ Source](https://github.com/alengodev/SuluDoctrineCompatibilityBundle)[ Packagist](https://packagist.org/packages/alengo/doctrine-compatibility-bundle)[ Docs](https://github.com/alengodev/SuluDoctrineCompatibilityBundle)[ RSS](/packages/alengo-doctrine-compatibility-bundle/feed)WikiDiscussions 1.x Synced 3mo ago

READMEChangelog (1)Dependencies (7)Versions (4)Used By (0)

SuluDoctrineCompatibilityBundle
===============================

[](#suludoctrinecompatibilitybundle)

A Symfony bundle that fixes runtime incompatibilities between **Sulu 3**, **Doctrine ORM 3.x**, and **Gedmo DoctrineExtensions**.

The Problem
-----------

[](#the-problem)

Sulu 3, Doctrine ORM 3.x, and Gedmo DoctrineExtensions all underwent major version changes around the same time. The combination of these three libraries produces three distinct bugs that surface at runtime.

**1. Gedmo TreeListener fails for Sulu's Page entity**

`Sulu\Page\Domain\Model\Page` is declared as a `` in Sulu's ORM XML. Gedmo's `ExtensionMetadataFactory` explicitly returns `[]` for mapped-superclasses, so any call to `getConfiguration()` or `getStrategy()` with `SuluPage::class` throws:

```
UnexpectedValueException: Tree object class: Sulu\Page\Domain\Model\Page must have tree metadata at this point

```

**2. Gedmo TreeObjectHydrator fails with Doctrine ORM 3.x**

Doctrine ORM 3.x removed the `mappedBy` property from owning-side `ManyToOneAssociationMapping`. Gedmo's hydrator unconditionally accesses it for all associations, throwing:

```
Error: Unknown property "mappedBy" on class Doctrine\ORM\Mapping\ManyToOneAssociationMapping

```

**3. Inherited association mappings missing `declared` property**

When extending Sulu's Page or Article entities with Doctrine ORM 3.x and `report_fields_where_declared: true`, inherited association mappings have `null` as their `declared` property, causing schema validation errors.

Installation
------------

[](#installation)

```
composer require alengo/doctrine-compatibility-bundle
```

The bundle registers itself automatically via Symfony Flex.

Configuration
-------------

[](#configuration)

The default configuration works for standard Sulu projects where the concrete Page entity is `App\Entity\Page`. To override:

```
# config/packages/alengo_doctrine_compatibility.yaml
alengo_doctrine_compatibility:
    page_entity_class: App\Entity\Page  # adjust if your class differs
```

The configured class must extend `Sulu\Page\Domain\Model\Page`.

How It Works
------------

[](#how-it-works)

### `SuluPageAwareTreeListener`

[](#sulupageawaretreelistener)

Extends Gedmo's `TreeListener` and overrides `getConfiguration()` and `getStrategy()`. Any call with `Sulu\Page\Domain\Model\Page` is transparently delegated to the configured concrete Page entity class, which has valid tree metadata.

Registered via `CompilerPass` — overrides the `stof_doctrine_extensions.listener.tree` service after all bundle extensions have loaded, ensuring correct behavior regardless of bundle registration order.

### `SafeTreeObjectHydrator`

[](#safetreeobjecthydrator)

Extends Gedmo's `TreeObjectHydrator` and overrides `getChildrenField()` to skip owning-side `ManyToOne` associations before accessing `mappedBy`, which does not exist in Doctrine ORM 3.x for owning-side mappings.

Registered as the `sulu_page_tree` hydrator via `CompilerPass`, overriding Sulu's default registration across all configured entity managers.

### `InheritedAssociationDeclaredFixerSubscriber`

[](#inheritedassociationdeclaredfixersubscriber)

Listens to Doctrine's `loadClassMetadata` event and resolves the `declared` property for inherited association mappings where it is `null`, by walking the class hierarchy via reflection.

Requirements
------------

[](#requirements)

PackageVersionPHP`^8.2`Sulu`^3.0`Doctrine ORM`^3.0`Gedmo DoctrineExtensions`^3.0`stof/doctrine-extensions-bundle`^1.11`Symfony`^7.0`License
-------

[](#license)

MIT — [alengo.dev](https://alengo.dev)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance82

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

91d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a3bea97975bdeddcfa5b76c222740e703e4ff5f9bbf5f6d5d75e8827e0a48ac?d=identicon)[alengodev](/maintainers/alengodev)

---

Top Contributors

[![hual7](https://avatars.githubusercontent.com/u/89628357?v=4)](https://github.com/hual7 "hual7 (6 commits)")

### Embed Badge

![Health badge](/badges/alengo-doctrine-compatibility-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/alengo-doctrine-compatibility-bundle/health.svg)](https://phpackages.com/packages/alengo-doctrine-compatibility-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M737](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M204](/packages/sulu-sulu)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
