Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fmasa/doctrine-nullable-embeddables
Mechanism for nullable embeddables in Doctrine 2.5+
https://github.com/fmasa/doctrine-nullable-embeddables
ddd doctrine2 embeddables orm value-object
Last synced: 4 months ago
JSON representation
Mechanism for nullable embeddables in Doctrine 2.5+
- Host: GitHub
- URL: https://github.com/fmasa/doctrine-nullable-embeddables
- Owner: fmasa
- Created: 2017-07-04T18:15:30.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-26T17:26:35.000Z (almost 7 years ago)
- Last Synced: 2024-09-18T08:34:20.059Z (4 months ago)
- Topics: ddd, doctrine2, embeddables, orm, value-object
- Language: PHP
- Size: 18.6 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Doctrine nullable embeddables
[![Build Status](https://travis-ci.org/fmasa/doctrine-nullable-embeddables.svg?branch=master)](https://travis-ci.org/fmasa/doctrine-nullable-embeddables)
[![Coverage Status](https://coveralls.io/repos/github/fmasa/doctrine-nullable-embeddables/badge.svg?branch=master)](https://coveralls.io/github/fmasa/doctrine-nullable-embeddables?branch=master)This package serves as workaround for Doctrine's lack of support of nullable embeddables due to implementation of embeddables in Doctrine 2.5+
For more informations about the issue see [doctrine/doctrine2](https://github.com/doctrine/doctrine2/issues/4568).## Installation
The best way to install fmasa/doctrine-yaml-annotations is using [Composer](https://getcomposer.org/):$ composer require fmasa/doctrine-nullable-embeddables
There are several conditions that has to be met:
- Property with nullable embeddable must use `Fmasa\DoctrineNullableEmbeddables\Annotations\Nullable` annotation.
- Every property in nullable embeddable must be nullable (or must use `Nullable` annotation if it's embeddable)Now all you have to do is register `Fmasa\DoctrineNullableEmbeddables\Subscriber` and you have nullable embeddables working:
```php
/* @var $annotationReader Doctrine\Common\Annotations\Reader */
/* @var $em Doctrine\ORM\EntityManager */$evm->addEventSubscriber(new Fmasa\DoctrineNullableEmbeddables\Subscriber($annotationReader));
```### But I'm using YAML for mapping!
See [fmasa/doctrine-yaml-annotations](https://github.com/fmasa/doctrine-yaml-annotations) to make extensions like this work with YAML mapping.