skaut/doctrine-nullable-embeddables

This package is abandoned and no longer maintained. No replacement package was suggested.

Mechanism for nullable embeddables in Doctrine 2.5+

1.1.1 2023-01-15 10:44 UTC

This package is auto-updated.

Last update: 2023-02-15 10:59:03 UTC


README

Build Status Coverage Status

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\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:

/* @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.