Skip to content

Commit

Permalink
tec: Validate only new entities during importation
Browse files Browse the repository at this point in the history
This allows to not fail for reasons that are outside of the scope of the
importer. It should also improve the performance a bit.
  • Loading branch information
marien-probesys committed Sep 13, 2024
1 parent 5215858 commit c8e3cc6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Service/DataImporter/DataImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1562,9 +1562,14 @@ private function importMessageDocuments(): \Generator
yield from $this->importEntities($messageDocuments);
}

private function validate(object $object): string
private function validate(Entity\EntityInterface $entity): string
{
$rawErrors = $this->validator->validate($object);
if ($entity->getId() !== null) {
// Don't validate entities that are already saved in the database.
return '';
}

$rawErrors = $this->validator->validate($entity);
if (count($rawErrors) === 0) {
return '';
}
Expand Down

0 comments on commit c8e3cc6

Please sign in to comment.