PHPackages                             huluti/doctrine-relations-analyser - 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. huluti/doctrine-relations-analyser

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

huluti/doctrine-relations-analyser
==================================

A Symfony bundle that provides tools for analyzing Doctrine relationships

0.8.0(5mo ago)156.6k↑143.4%1MITPHPPHP &gt;=8.1CI failing

Since Jul 18Pushed 3w ago1 watchersCompare

[ Source](https://github.com/Huluti/DoctrineRelationsAnalyser)[ Packagist](https://packagist.org/packages/huluti/doctrine-relations-analyser)[ Docs](https://github.com/Huluti/DoctrineRelationsAnalyser)[ Fund](https://liberapay.com/hugoposnic)[ RSS](/packages/huluti-doctrine-relations-analyser/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (16)Versions (11)Used By (0)

Doctrine Relations Analyzer
===========================

[](#doctrine-relations-analyzer)

[![Packagist Version](https://camo.githubusercontent.com/36b66505d20c5f4dacad349aaaa7a558b087a2a590022ef3aa640d418baf1272/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f68756c7574692f646f637472696e652d72656c6174696f6e732d616e616c79736572)](https://camo.githubusercontent.com/36b66505d20c5f4dacad349aaaa7a558b087a2a590022ef3aa640d418baf1272/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f68756c7574692f646f637472696e652d72656c6174696f6e732d616e616c79736572)[![Packagist License](https://camo.githubusercontent.com/fbc76b9931e49bcfbde909c42c946e97b15e845e58b464321fc17fc76513f64a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f68756c7574692f646f637472696e652d72656c6174696f6e732d616e616c79736572)](https://camo.githubusercontent.com/fbc76b9931e49bcfbde909c42c946e97b15e845e58b464321fc17fc76513f64a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f68756c7574692f646f637472696e652d72656c6174696f6e732d616e616c79736572)[![Packagist Downloads](https://camo.githubusercontent.com/5a05e3a02e41463d0dddc2b6b7a8e7301ec9e3494ae28fc4e025be9d16ffdf64/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f68756c7574692f646f637472696e652d72656c6174696f6e732d616e616c79736572)](https://camo.githubusercontent.com/5a05e3a02e41463d0dddc2b6b7a8e7301ec9e3494ae28fc4e025be9d16ffdf64/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f68756c7574692f646f637472696e652d72656c6174696f6e732d616e616c79736572)

Overview
--------

[](#overview)

Doctrine Relations Analyzer is a tool designed to analyze and visualize cascade relationships within Doctrine ORM entities in Symfony projects. It helps developers understand how deletion operations propagate through related entities and assists in identifying potential issues or optimizations in data management strategies.

Note

**Why is it important?**

Managing cascade operations, especially deletions, is crucial to avoid unintentional data loss. This tool provides a human-readable summary to help developers review and understand these relationships, ensuring they are intentional and correctly implemented.

Warning

This project is a work in progress. Contributions and feedback are welcome.
It is currently in an exploratory or "discovery" phase, which means many things are subject to change — including configuration formats, naming conventions, and APIs.
We're very open to suggestions and improvements, and that's why we're keeping the version under `0.x` for now.

Usage
-----

[](#usage)

### Requirements

[](#requirements)

- PHP &gt;= 8.1
- Symfony &gt;= 6.4
- Doctrine 2|3
- Graphviz package:
    - **For Alpine Linux:** `graphviz fontconfig ttf-freefont`

### Installation

[](#installation)

#### Applications that use Symfony Flex

[](#applications-that-use-symfony-flex)

Open a command console, enter your project directory and execute:

```
composer require --dev huluti/doctrine-relations-analyser
```

#### Applications that don't use Symfony Flex

[](#applications-that-dont-use-symfony-flex)

##### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
composer require --dev huluti/doctrine-relations-analyser
```

##### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    DoctrineRelationsAnalyserBundle\DoctrineRelationsAnalyserBundle::class => ['dev' => true, 'test' => true],
];
```

### Usage

[](#usage-1)

#### Analysis

[](#analysis)

Command to easily visualise the relationships between Doctrine entities

```
php bin/console doctrine-relations-analyser:analyse

```

##### Command-line Arguments

[](#command-line-arguments)

- --entities: Optional. Comma-separated list of entities to analyze
- -m, --mode: Optional. Analysis mode (all, deletions) \[default: "all"\]
- -o, --output: Optional. Output path for reports generated
- -g, --graph: Optional. Generate Graphviz graph
- --graph-format: Optional. Graph image format (png, svg) \[default: "png"\]
- -V, --version: Optional. Display help for the given command. When no command is given display help for the list command
- -h, --help: Optional. Display this application version

#### Examples

[](#examples)

To check deletion relations of two entities in a graph:

```
php bin/console doctrine-relations-analyser:analyse -o data/ -g --entities="App\\Entity\\User,App\\Entity\\Workspace" -m deletions

```

#### Validation

[](#validation)

Command to validate Doctrine relationships between entities against configuration file of bundle. It can be integrated into CI/CD pipelines to ensure that the expected relationships are maintained.

```
php bin/console doctrine-relations-analyser:validate

```

##### Configuration file

[](#configuration-file)

The configuration file is located at `config/packages/doctrine_relations_analyser.yaml`. It allows you to define the expected relationships between entities, including which entities should be deleted when a parent entity is deleted.

```
# config/packages/doctrine_relations_analyser.yaml
doctrine_relations_analyser:
  entities:
    DoctrineRelationsAnalyserBundle\Tests\Entity\Post:  # to customize with your own entities
      relations:
        comments:
          class: DoctrineRelationsAnalyserBundle\Tests\Entity\Comment  # to customize with your own entities
          deletion: true
          deletion_type: database  # or 'orm'
```

##### Command-line Arguments

[](#command-line-arguments-1)

- -V, --version: Optional. Display help for the given command. When no command is given display help for the list command
- -h, --help: Optional. Display this application version

Limitations
-----------

[](#limitations)

- Only work with first joinColumn for now.

Contributions
-------------

[](#contributions)

Contributions are welcome! If you have ideas for improvements, new features, or bug fixes, please open an issue or a pull request.

Interesting readings
--------------------

[](#interesting-readings)

- [How to delete… not to delete yourself?](https://accesto.com/blog/how-to-delete-to-not-delete-yourself)

License
-------

[](#license)

This project is licensed under the MIT License.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance84

Actively maintained with recent releases

Popularity33

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

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 ~59 days

Recently: every ~133 days

Total

10

Last Release

169d ago

PHP version history (2 changes)0.1.0PHP &gt;=8.0

0.4.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/a0a1f1e33e08fa712c9bb1fd685235c63a712c370af3c1c74792180115a62893?d=identicon)[hugoposnic](/maintainers/hugoposnic)

---

Top Contributors

[![Huluti](https://avatars.githubusercontent.com/u/5782198?v=4)](https://github.com/Huluti "Huluti (87 commits)")

---

Tags

doctrinemitphprelationssymfonysymfony-bundlevizualizersymfonybundledoctrinerelations

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/huluti-doctrine-relations-analyser/health.svg)

```
[![Health](https://phpackages.com/badges/huluti-doctrine-relations-analyser/health.svg)](https://phpackages.com/packages/huluti-doctrine-relations-analyser)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M376](/packages/easycorp-easyadmin-bundle)[sulu/sulu

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

1.3k1.4M196](/packages/sulu-sulu)[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.

1155.2k](/packages/rcsofttech-audit-trail-bundle)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9317.2k55](/packages/open-dxp-opendxp)

PHPackages © 2026

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