Skip to content

Commit 53364d7

Browse files
committed
Explicitly check null for the value
1 parent accc925 commit 53364d7

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/Revisionable/Document/Repository/RevisionRepository.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,13 @@ protected function fillDocument(object $document, array $data): void
124124
$mapping = $documentMeta->getFieldMapping($field);
125125

126126
// Fill the embedded document
127-
if ($documentWrapper->isEmbeddedAssociation($field)) {
128-
if (!empty($value)) {
129-
assert(class_exists($mapping['targetDocument']));
130-
131-
$embeddedMetadata = $this->getDocumentManager()->getClassMetadata($mapping['targetDocument']);
132-
$document = $embeddedMetadata->newInstance();
133-
$this->fillDocument($document, $value);
134-
$value = $document;
135-
}
127+
if ($documentWrapper->isEmbeddedAssociation($field) && null !== $value) {
128+
assert(class_exists($mapping['targetDocument']));
129+
130+
$embeddedMetadata = $this->getDocumentManager()->getClassMetadata($mapping['targetDocument']);
131+
$document = $embeddedMetadata->newInstance();
132+
$this->fillDocument($document, $value);
133+
$value = $document;
136134
} elseif ($documentMeta->isSingleValuedAssociation($field)) {
137135
assert(class_exists($mapping['targetDocument']));
138136

0 commit comments

Comments
 (0)