PHPackages                             sergeil/doctrine-entity-data-mapper-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. sergeil/doctrine-entity-data-mapper-bundle

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

sergeil/doctrine-entity-data-mapper-bundle
==========================================

Makes it easy to map data coming from client-side onto your Doctrine ORM managed entities.

176[1 PRs](https://github.com/sergeil/SliDoctrineEntityDataMapperBundle/pulls)PHP

Since Dec 31Pushed 9y ago2 watchersCompare

[ Source](https://github.com/sergeil/SliDoctrineEntityDataMapperBundle)[ Packagist](https://packagist.org/packages/sergeil/doctrine-entity-data-mapper-bundle)[ RSS](/packages/sergeil-doctrine-entity-data-mapper-bundle/feed)WikiDiscussions develop Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

SliDoctrineEntityDataMapperBundle [![Build Status](https://camo.githubusercontent.com/a10bec85920b096a7a102cb0b3852fcec2cab889447d8da56f30bfae6e8e1805/68747470733a2f2f7472617669732d63692e6f72672f7365726765696c2f536c69446f637472696e65456e74697479446174614d617070657242756e646c652e7376673f6272616e63683d646576656c6f70)](https://travis-ci.org/sergeil/SliDoctrineEntityDataMapperBundle)
==============================================================================================================================================================================================================================================================================================================================================================================================

[](#slidoctrineentitydatamapperbundle-)

Bundle provides tools that simplify mapping data coming from client-side onto Doctrine ORM managed entities.

Features:

- All basic scalar types mapping (boolean, numbers ...)
- All types of associations are supported (+bidirectional aspect of relations is taken care of out of the box)
- Complex data types transformation and mapping - when a value before being mapped onto an entity is transformed
- Additional DI services injection to a setter method when a value is mapped
- Flexible mapping of date/datetimes

Teaser with ManyToMany relation
-------------------------------

[](#teaser-with-manytomany-relation)

For an illustration purpose let's take a classical example of User and Group entities and assume that they are bidirectionally linked to each other.

[![User and Group](Resources/doc/erd.png)](Resources/doc/erd.png)

Now, let's take a look at several sample array data-structures that you may pass to EntityDataMapperService and have it properly mapped data onto your entity. For the illustration purpose we assume that we have two users - "Jane Doe" and "John Doe" with corresponding IDs of 1 and 2, and three groups: "Admins", "Users", "Moderators" with IDs 1, 2, 3.

```
$em = $container->get('doctrine.orm.entity_manager');
$mapper = $container->get('sli_doctrine_entity_data_mapper.mapping.entity_data_mapper');

$adminsGroup = $em->find('MyBundle:Group', 1);
$usersGroup = $em->find('MyBundle:Group', 2);
$moderatorsGroup = $em->find('MyBundle:Group', 3);

$john = new User('John Doe');
$jane = new User('Jane Doe');

$userParams = array(
    'groups' => [1, 2]
);

$mapper->mapEntity($john, $userParams, array_keys($userParams));

$em->persist($john);
$em->persist($jane);
$em->flush();

echo count($john->groups); // two elements, groups "Admins" and "Users" were fetched from database by their IDs
echo count($adminGroup->users); // one element
echo count($usersGroup->users); // one element
echo count($moderatorsGroup->users); // zero elements
```

Now let's presume that during next request we want that $john user would belong only to "Moderators" group:

```
$userParams = array(
    'groups' => [3]
);

$mapper->mapEntity($john, $userParams, array_keys($userParams));
```

Several things just happened:

- "Admins" and "Users" group were removed from User's side Collection
- "John Doe" was removed from "Admins" and "Users" Group's Collections
- "John Doe" was added to "Moderators" group
- "Moderators" group was added to John Doe's groups collection

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

[](#installation)

Add this dependency to your composer.json:

```
"sergeil/doctrine-entity-data-mapper-bundle": "dev-develop"

```

Update your AppKernel class and add this:

```
new Sli\DoctrineEntityDataMapperBundle\SliDoctrineEntityDataMapperBundle(),

```

Documentation
-------------

[](#documentation)

See `Resources/doc/index.md`.

Licensing
---------

[](#licensing)

This bundle is under the MIT license. See the complete license in the bundle: Resources/meta/LICENSE

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/32010d9d9c2226f0c7119fb1d4006d1847a6dd6db135d2fcacba8578a8a13b90?d=identicon)[sergeil](/maintainers/sergeil)

---

Top Contributors

[![sergeil](https://avatars.githubusercontent.com/u/425579?v=4)](https://github.com/sergeil "sergeil (9 commits)")

### Embed Badge

![Health badge](/badges/sergeil-doctrine-entity-data-mapper-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/sergeil-doctrine-entity-data-mapper-bundle/health.svg)](https://phpackages.com/packages/sergeil-doctrine-entity-data-mapper-bundle)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[pgvector/pgvector

pgvector support for PHP

198741.5k12](/packages/pgvector-pgvector)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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