PHPackages                             tourze/doctrine-resolve-target-entity-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. tourze/doctrine-resolve-target-entity-bundle

ActiveLibrary[Database &amp; ORM](/categories/database)

tourze/doctrine-resolve-target-entity-bundle
============================================

Symfony bundle for entity decoupling using Doctrine's ResolveTargetEntity

1.0.5(6mo ago)013.8k20MITPHPCI passing

Since May 8Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/tourze/doctrine-resolve-target-entity-bundle)[ Packagist](https://packagist.org/packages/tourze/doctrine-resolve-target-entity-bundle)[ RSS](/packages/tourze-doctrine-resolve-target-entity-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (16)Versions (8)Used By (20)

Doctrine Resolve Target Entity Bundle
=====================================

[](#doctrine-resolve-target-entity-bundle)

[![PHP](https://camo.githubusercontent.com/092d545f529c0bc11f393035f40f9cced2c9db2a0d148532f4fc2aa5409dc992/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e312d3737374242342e737667)](https://php.net)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)[![Build Status](https://github.com/tourze/php-monorepo/workflows/CI/badge.svg)](https://github.com/tourze/php-monorepo/actions)[![Coverage Status](https://camo.githubusercontent.com/597d3736c612eb152d4c13a37f4e87afd6af836788df1857d930b70903f9553d/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f746f75727a652f7068702d6d6f6e6f7265706f2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/tourze/php-monorepo?branch=master)

[English](README.md) | [中文](README.zh-CN.md)

Table of Contents
-----------------

[](#table-of-contents)

- [Overview](#overview)
- [Features](#features)
- [Installation](#installation)
- [Quick Start](#quick-start)
    - [Register the Bundle](#register-the-bundle)
    - [Define an Interface](#define-an-interface)
    - [Create Entity Implementation](#create-entity-implementation)
    - [Use Interface in Related Entities](#use-interface-in-related-entities)
- [Configuration](#configuration)
- [Services](#services)
- [Advanced Usage](#advanced-usage)
- [Error Handling](#error-handling)
- [Security](#security)
- [Dependencies](#dependencies)
- [License](#license)

Overview
--------

[](#overview)

A Symfony bundle that provides entity decoupling functionality through Doctrine's ResolveTargetEntity feature. This bundle allows you to define interfaces in your entities and map them to concrete implementations at runtime, enabling better architectural separation and flexibility.

Features
--------

[](#features)

- **Entity Decoupling**: Use interfaces instead of concrete classes in entity relationships
- **Runtime Resolution**: Map interfaces to concrete implementations at container compilation time
- **Flexible Architecture**: Easily swap implementations without changing entity definitions
- **Doctrine Integration**: Seamlessly integrates with Doctrine ORM's ResolveTargetEntity feature

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

[](#installation)

```
composer require tourze/doctrine-resolve-target-entity-bundle
```

Quick Start
-----------

[](#quick-start)

### Register the Bundle

[](#register-the-bundle)

Add the bundle to your `config/bundles.php`:

```
return [
    // ...
    Tourze\DoctrineResolveTargetEntityBundle\DoctrineResolveTargetEntityBundle::class => ['all' => true],
];
```

### Define an Interface

[](#define-an-interface)

```
