Skip to content

Commit b46085b

Browse files
committed
Go back to nested to avoid hitting the else branch
1 parent cf8d870 commit b46085b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/Revisionable/Document/Repository/RevisionRepository.php

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

126126
// Fill the embedded document
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;
127+
if ($documentWrapper->isEmbeddedAssociation($field)) {
128+
if (null !== $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+
}
134136
} elseif ($documentMeta->isSingleValuedAssociation($field)) {
135137
assert(class_exists($mapping['targetDocument']));
136138

0 commit comments

Comments
 (0)