PHPackages                             rezzza/doctrine-schema-multi-mapping - 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. rezzza/doctrine-schema-multi-mapping

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

rezzza/doctrine-schema-multi-mapping
====================================

Allow to use doctrine schema commands when multi mapping defined.

37134[1 issues](https://github.com/rezzza/doctrine-schema-multi-mapping/issues)PHP

Since Oct 6Pushed 10y ago5 watchersCompare

[ Source](https://github.com/rezzza/doctrine-schema-multi-mapping)[ Packagist](https://packagist.org/packages/rezzza/doctrine-schema-multi-mapping)[ RSS](/packages/rezzza-doctrine-schema-multi-mapping/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Doctrine Schema Multi Mapping
=============================

[](#doctrine-schema-multi-mapping)

Installation on Symfony.
========================

[](#installation-on-symfony)

Activate the bundle in `AppKernel`:

```
    if (in_array($this->getEnvironment(), array('test'))) {
        $bundles[] = new Rezzza\DoctrineSchemaMultiMapping\App\Bundle\DoctrineSchemaMultiMappingBundle();
    }
```

Usage
=====

[](#usage)

```
./app/console rezzza:doctrine-multi-mapping:schema:create --em=default  --env=test
./app/console rezzza:doctrine-multi-mapping:schema:update --em=default  --env=test
./app/console rezzza:doctrine-multi-mapping:schema:drop --em=default  --env=test

```

**You should consider this bundle has not to be used in a production environment**.

Why are we using it ?
---------------------

[](#why-are-we-using-it-)

In Doctrine2, if you define multiple mappings for the same entity then `doctrine:schema:*` commands will fail because it will try to create 2 SQL tables with the same name instead of combining all entities mappings representing the same entity from various points of view.

Example: Acme e-commerce application with many User entities
------------------------------------------------------------

[](#example-acme-e-commerce-application-with-many-user-entities)

We want to express a User model in different bounded contexts.

### Definition of User entity in Account bounded context

[](#definition-of-user-entity-in-account-bounded-context)

We have a \\Acme\\User\\Account\\User.php entity.

In this bounded context, we need to manage User authentication &amp; signin so a (simple) mapping could be:

```
    - id
    - username
    - password
    - first_name
    - last_name

```

### Definition of User entity Cart bounded context

[](#definition-of-user-entity-cart-bounded-context)

We have a \\Acme\\User\\Cart\\User.php entity.

In this bounded context, we don't have to bother with autentication concerns, we just need to know user's e-commerce relative informations.

```
    - id
    - first_name
    - last_name
    - is_first_order

```

***This kind of application in your production environment could work with a shared database and you would have to manually define migrations***

With this example, Doctrine will have 2 times a definition for table `user` and will throw an exception.

**This library merge the 2 entities mappings ONLY for `doctrine:schema:*` commands**.

This bundle provide by this way 3 commands, to replace `doctrine:schema:*` command, you have to replace namespace by `rezzza:doctrine-multi-mapping:schema:*`.

Which doctrine mapping features are not supported?
==================================================

[](#which-doctrine-mapping-features-are-not-supported)

At the moment, only inheritance type “none“ and “single\_table“ are supported, feel free to make a PR to support others.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/47c3006a9e7662031ee9d3fa064238fef88479fd7d60f18dd47f038fbbd7dc5a?d=identicon)[steph\_py](/maintainers/steph_py)

---

Top Contributors

[![stephpy](https://avatars.githubusercontent.com/u/232744?v=4)](https://github.com/stephpy "stephpy (4 commits)")[![shouze](https://avatars.githubusercontent.com/u/54712?v=4)](https://github.com/shouze "shouze (2 commits)")[![tyx](https://avatars.githubusercontent.com/u/245494?v=4)](https://github.com/tyx "tyx (2 commits)")

### Embed Badge

![Health badge](/badges/rezzza-doctrine-schema-multi-mapping/health.svg)

```
[![Health](https://phpackages.com/badges/rezzza-doctrine-schema-multi-mapping/health.svg)](https://phpackages.com/packages/rezzza-doctrine-schema-multi-mapping)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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