PHPackages                             orbitale/entity-merger - 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. orbitale/entity-merger

Abandoned → [symfony/serializer](/?search=symfony%2Fserializer)Library[Database &amp; ORM](/categories/database)

orbitale/entity-merger
======================

Merge arrays into your object entities

v0.6.0(8y ago)1612.0k[1 issues](https://github.com/Orbitale/EntityMerger/issues)MITPHPPHP ^5.5|^7.0CI failing

Since Jan 23Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Orbitale/EntityMerger)[ Packagist](https://packagist.org/packages/orbitale/entity-merger)[ Docs](https://github.com/Orbitale/EntityMerger)[ RSS](/packages/orbitale-entity-merger/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (6)Versions (7)Used By (0)

⚠️ This package is unmaintained. Please look at better solutions, like serializers.

Entity Merger
=============

[](#entity-merger)

Entity/object merger for PHP apps.

Installation
============

[](#installation)

Install with [Composer](https://getcomposer.org/), it's the best packages manager you can have:

```
composer require orbitale/entity-merger
```

Requirements
============

[](#requirements)

- PHP 5.3.3 or more
- Any Doctrine `ObjectManager` (optional)
- [Symfony Serializer](https://github.com/symfony/serializer) (optional)
- [JMS Serializer](https://github.com/schmittjoh/serializer) (optional)

Basic usage
===========

[](#basic-usage)

**Note:** The `EntityMerger` only works with **mapped objects**. The properties must exist, and it cannot use magic methods to retrieve datas.

```
use Orbitale\Component\EntityMerger\EntityMerger;

$merger = new EntityMerger();

$object = new Object();
$object->setField(null);

$postedDatas = array('field' => 'value');

$merger->merge($object, $postedDatas);

echo $object->getField(); // Shows "value"
```

Using the Doctrine ORM ObjectManager
====================================

[](#using-the-doctrine-orm-objectmanager)

The `EntityMerger` accepts a `Doctrine\ORM\ObjectManager` as first argument, like the `EntityManager` for instance. This allows better and deeper merging when using ORM-mapped entities, by automatically using the Doctrine Metadatas to detect property types. If you are using the `EntityMerger` in an application that uses Doctrine, it is highly recommended to inject the `ObjectManager` to use your mapping as type reference for each of your class properties.

If no `ObjectManager` is used, the `EntityMerger` will perform its own checks with its own metadatas manager, but it is obviously less performant than the Doctrine one, because it cannot assume that you are attempting to merge an entity. It instead makes its checks based on PHPDoc, class imports and default parameters, so be sure to perfectly write your PHPDoc in your class if you do not want to use the `ObjectManager`!

Using the Serializer
====================

[](#using-the-serializer)

The `EntityMerger` accepts a `Serializer` as second argument. It can both use the native [Symfony Serializer](https://github.com/symfony/serializer)and the powerful [JMS Serializer](https://github.com/schmittjoh/serializer).

**Note:** If you are using Symfony &lt;2.5 and still want to use the serializer, then you'll have to switch to the JMS' one, or you may have some unexpected behavior because of the lack of the `PropertyNormalizer` class.

Using the `Serializer` allows you to merge two objects in the specified one by serializing the `dataObject` parameter into an array, and using it as values to merge in your object/entity.

**Note:** Of course you can use your own serialization method to inject the `dataObject` as array in your merge process.

Advanced usage
==============

[](#advanced-usage)

Merge two objects in the first one (must use any serializer):

```
use Orbitale\Component\EntityMerger\EntityMerger;

$merger = new EntityMerger(null, $serializer);

$baseObject = new Object;
$baseObject->field = null;

$anotherObject = new Object();
$anotherObject->field = 'value';

$merger->merge($baseObject, $anotherObject);

echo $baseObject->field; // Shows "value"
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Recently: every ~215 days

Total

6

Last Release

3238d ago

PHP version history (2 changes)v0.1PHP &gt;=5.3.3

v0.6.0PHP ^5.5|^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/287671e403432448ba0e76aefac027294e5117497df9f9c06f0c45f3d2d75415?d=identicon)[Pierstoval](/maintainers/Pierstoval)

---

Top Contributors

[![Pierstoval](https://avatars.githubusercontent.com/u/3369266?v=4)](https://github.com/Pierstoval "Pierstoval (38 commits)")

---

Tags

symfonyormdoctrineentitymerge

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/orbitale-entity-merger/health.svg)

```
[![Health](https://phpackages.com/badges/orbitale-entity-merger/health.svg)](https://phpackages.com/packages/orbitale-entity-merger)
```

###  Alternatives

[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[sonata-project/doctrine-orm-admin-bundle

Integrate Doctrine ORM into the SonataAdminBundle

46117.7M155](/packages/sonata-project-doctrine-orm-admin-bundle)[fresh/doctrine-enum-bundle

Provides support of ENUM type for Doctrine2 in Symfony applications.

4636.8M12](/packages/fresh-doctrine-enum-bundle)[goodwix/doctrine-json-odm

JSON Object-Document Mapping bundle for Symfony and Doctrine

2226.0k](/packages/goodwix-doctrine-json-odm)[indaxia/doctrine-orm-transformations

Provides JSON-ready Doctrine ORM Entity-Array transfomtaions

1296.4k](/packages/indaxia-doctrine-orm-transformations)[andsalves/doctrine-elastic

Elasticsearch Doctrine Adaptation

156.6k](/packages/andsalves-doctrine-elastic)

PHPackages © 2026

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