PHPackages                             pechynho/polymorphic-doctrine - 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. pechynho/polymorphic-doctrine

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

pechynho/polymorphic-doctrine
=============================

Doctrine polymorphic relations for Symfony applications.

v0.2.0(1mo ago)03MITPHPPHP &gt;=8.4

Since Jul 16Pushed 9mo agoCompare

[ Source](https://github.com/Pechynho/polymorphic-doctrine)[ Packagist](https://packagist.org/packages/pechynho/polymorphic-doctrine)[ RSS](/packages/pechynho-polymorphic-doctrine/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (39)Versions (5)Used By (0)

Polymorphic Doctrine
====================

[](#polymorphic-doctrine)

A Symfony bundle that provides polymorphic relations for Doctrine ORM, allowing you to create flexible associations where a single property can reference different entity types.

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

Features
--------

[](#features)

- **Two polymorphic modes**: Dynamic and Explicit
- **Type-safe polymorphic relations** with proper IDE support
- **Foreign key constraints** preservation (explicit mode)
- **Query builder integration** for searching polymorphic values
- **Automatic reference class generation** for explicit mode
- **Caching support** for improved performance

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

[](#installation)

Install the bundle via Composer:

```
composer require pechynho/polymorphic-doctrine
```

If you're not using Symfony Flex, add the bundle to your `config/bundles.php`:

```
