diff --git a/tests/Enum/LoadEnumToEntityIntegrationTest.php b/tests/Enum/LoadEnumToEntityIntegrationTest.php index ccaaf60..9fa265a 100644 --- a/tests/Enum/LoadEnumToEntityIntegrationTest.php +++ b/tests/Enum/LoadEnumToEntityIntegrationTest.php @@ -60,6 +60,14 @@ public function testLoadEnumInEmbeddableWeNeedToGoDeeper() $this->assertSame(FooEnum::get(FooEnum::ONE), $foo->getEmbedded()->getEmbedded()->getEnum()); } + public function testLoadEnumInNotLoadedEmbeddable() + { + $foo = new FooEntity(); + $this->callPostLoadEventOnEntity($foo); + + $this->assertNull($foo->getNotLoadedEmbedded()); + } + public function testLoadEnumMissingEnumClass() { $this->expectException(\Doctrine\Common\Annotations\AnnotationException::class); diff --git a/tests/Enum/data/FooEntity.php b/tests/Enum/data/FooEntity.php index 2e0993e..1431ded 100644 --- a/tests/Enum/data/FooEntity.php +++ b/tests/Enum/data/FooEntity.php @@ -40,6 +40,14 @@ class FooEntity extends \Consistence\Doctrine\Enum\FooParentEntity */ private $embedded; + /** + * This simulates for example using partials where this was not selected + * + * @ORM\Embedded(class=FooEmbeddable::class, columnPrefix="not_loaded_") + * @var \Consistence\Doctrine\Enum\FooEmbeddable + */ + private $notLoadedEmbedded; + public function __construct() { $this->embedded = new FooEmbeddable(); @@ -68,4 +76,12 @@ public function getEmbedded(): FooEmbeddable return $this->embedded; } + /** + * @return \Consistence\Doctrine\Enum\FooEmbeddable + */ + public function getNotLoadedEmbedded() + { + return $this->notLoadedEmbedded; + } + }