PHPackages                             monro/doctrine-nullable-embedabbles - 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. monro/doctrine-nullable-embedabbles

ActiveLibrary

monro/doctrine-nullable-embedabbles
===================================

Workarround to the issues related of using Doctrine with embedabbles relations where the relation can be null. If the object is null doctrine would instanciate it with all the properties to null, this library will fix it to set it to null.

2.1.0(5y ago)65.1k1[2 issues](https://github.com/monro93/doctrine-nullable-embeddables/issues)MITPHPPHP ^7.4 || 8.0.0CI failing

Since Jan 13Pushed 5y ago1 watchersCompare

[ Source](https://github.com/monro93/doctrine-nullable-embeddables)[ Packagist](https://packagist.org/packages/monro/doctrine-nullable-embedabbles)[ RSS](/packages/monro-doctrine-nullable-embedabbles/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (6)Versions (15)Used By (0)

[![Build Status](https://camo.githubusercontent.com/4529dc1b1b3a0f195c98234bc0ec30b0069b174fff1868db1b07cd1b4fb324f1/68747470733a2f2f7472617669732d63692e636f6d2f6d6f6e726f39332f646f637472696e652d6e756c6c61626c652d656d6265646461626c65732e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/monro93/doctrine-nullable-embeddables) [![Coverage Status](https://camo.githubusercontent.com/a9a5212ad812b224dca7bb86ae0da2e2cb9234746cfb1ac6ad58562cf1748674/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d6f6e726f39332f646f637472696e652d6e756c6c61626c652d656d6265646461626c65732f62616467652e737667)](https://coveralls.io/github/monro93/doctrine-nullable-embeddables)

Why
===

[](#why)

The purpose of this library is to fix a [known bug on doctrine](https://github.com/doctrine/orm/issues/4568) where you cannot have nullable embeddables.

The issue is the following:

> Given a class "A" that has an ORM relation with an embedded "B" that could be null
> When an instance of "A" is loaded from DB and "B" is null
> Then an instance of "B" is created with all the values to null and assigned to the property "B" of "A"

The behaviour of this library will be the following:

> Given a class "A" that has an ORM relation with an embedded "B" that could be null
> When an instance of "A" is loaded from DB and "B" is null
> Then the property "B" of "A" is set to null

For now it only works with yml files as is what we use, if you think that will be useful to have it for XML or annotations, please [open an issue](https://github.com/monro93/doctrine-nullable-embeddables/issues/new)

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

[](#installation)

This library is mainly though to be used with symfony as it depends on its configuration files.

Syfmony
-------

[](#syfmony)

In your services.yaml (normally located at /config) Add this line:

```
imports:
    - { resource: ../vendor/monro/doctrine-nullable-embedabbles/src/EmbeNulls/config/services.yaml }
```

And if you need to change the doctrine.yaml location from the default one (`%kernel.project_dir%/config/packages/doctrine.yaml`), you can set the env variable `DOCTRINE_CONFIG_FILE`in your .env

Usage
=====

[](#usage)

Define your orm mappings as usual in your YML files and on the embedded property add nullable to true wherever you want. For instance:

```
#Dog.orm.yml
Some\Namespace\Dog:
    type: entity
    table: dog
    id: ...
    fields:
        name:
            type: string

    embedded:
        petIdentificationNumber:
            class: Some\Namespace\PetIdentificationNumber
            nullable: true
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 90% 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 ~32 days

Recently: every ~87 days

Total

12

Last Release

1952d ago

Major Versions

1.0.9 → v2.0.02020-11-17

PHP version history (3 changes)1.0.0PHP ^7.1

v2.0.0PHP ^7.4

2.1.0PHP ^7.4 || 8.0.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15449606?v=4)[Albert Montolio Romo](/maintainers/monro93)[@monro93](https://github.com/monro93)

---

Top Contributors

[![ovidals](https://avatars.githubusercontent.com/u/6129112?v=4)](https://github.com/ovidals "ovidals (9 commits)")[![monro93](https://avatars.githubusercontent.com/u/15449606?v=4)](https://github.com/monro93 "monro93 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/monro-doctrine-nullable-embedabbles/health.svg)

```
[![Health](https://phpackages.com/badges/monro-doctrine-nullable-embedabbles/health.svg)](https://phpackages.com/packages/monro-doctrine-nullable-embedabbles)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M648](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[neos/flow

Flow Application Framework

862.0M450](/packages/neos-flow)

PHPackages © 2026

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