fmasa / doctrine-nullable-embeddables
Mechanism for nullable embeddables in Doctrine 2.5+
Installs: 25 247
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 2
Open Issues: 1
pkg:composer/fmasa/doctrine-nullable-embeddables
Requires
- php: ^7.0
- doctrine/orm: ^2.5
Requires (Dev)
- phpunit/phpcov: ^4.0
- phpunit/phpunit: ^6.0
- satooshi/php-coveralls: ^1.0
This package is auto-updated.
Last update: 2024-10-17 00:14:00 UTC
README
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.
Installation
The best way to install fmasa/doctrine-yaml-annotations is using Composer:
$ composer require fmasa/doctrine-nullable-embeddables
There are several conditions that has to be met:
- Property with nullable embeddable must use
Fmasa\DoctrineNullableEmbeddables\Annotations\Nullableannotation. - Every property in nullable embeddable must be nullable (or must use
Nullableannotation if it's embeddable)
Now all you have to do is register Fmasa\DoctrineNullableEmbeddables\Subscriber and you have nullable embeddables working:
/* @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 to make extensions like this work with YAML mapping.