Skip to content

Commit ddef7fe

Browse files
committed
Enable empty fields check for document repository, remove commented code for similar in loggable
1 parent d782ce7 commit ddef7fe

File tree

3 files changed

+2
-15
lines changed

3 files changed

+2
-15
lines changed

src/Loggable/Document/Repository/LogEntryRepository.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,7 @@ protected function fillDocument($document, array $data)
143143
$value = $value ? $this->dm->getReference($mapping['targetDocument'], $value) : null;
144144
}
145145
$wrapped->setPropertyValue($field, $value);
146-
unset($fields[$field]);
147146
}
148-
149-
/*
150-
if (count($fields)) {
151-
throw new \Gedmo\Exception\UnexpectedValueException('Cound not fully revert the document to version: '.$version);
152-
}
153-
*/
154147
}
155148

156149
/**

src/Loggable/Entity/Repository/LogEntryRepository.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,6 @@ public function revert($entity, $version = 1)
136136
if (!$logsFound) {
137137
throw new UnexpectedValueException('Could not find any log entries under version: '.$version);
138138
}
139-
140-
/*if (count($fields)) {
141-
throw new \Gedmo\Exception\UnexpectedValueException('Could not fully revert the entity to version: '.$version);
142-
}*/
143139
}
144140

145141
/**

src/Revisionable/Document/Repository/RevisionRepository.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,12 @@ protected function fillDocument(object $document, array $data): void
142142
}
143143

144144
$documentWrapper->setPropertyValue($field, $value);
145-
unset($fields[$field]);
145+
unset($fields[array_search($field, $fields, true)]);
146146
}
147147

148-
/*
149148
if (count($fields)) {
150-
throw new UnexpectedValueException(sprintf('Could not fully revert document %s to version %d.', $documentMetadata->getName(), $version));
149+
throw new UnexpectedValueException(sprintf('Could not fully revert document %s.', $documentMeta->getName()));
151150
}
152-
*/
153151
}
154152

155153
/**

0 commit comments

Comments
 (0)