Skip to content

Commit

Permalink
Fix NotModifiedContentFilter when creating new translation
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremycr committed Feb 5, 2024
1 parent 877d537 commit 675ea28
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Filter/NotModifiedContentFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use CodeRhapsodie\EzDataflowBundle\Core\FieldComparator\FieldComparatorInterface;
use CodeRhapsodie\EzDataflowBundle\Model\ContentUpdateStructure;
use Ibexa\Contracts\Core\Repository\ContentService;
use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException;
use Psr\Log\LoggerAwareTrait;

/**
Expand Down Expand Up @@ -37,7 +38,12 @@ public function __invoke($data)
if ($data->getId()) {
$content = $this->contentService->loadContent($data->getId(), [$data->getLanguageCode()]);
} else {
$content = $this->contentService->loadContentByRemoteId($data->getRemoteId(), [$data->getLanguageCode()]);
try {
$content = $this->contentService->loadContentByRemoteId($data->getRemoteId(), [$data->getLanguageCode()]);
} catch (NotFoundException $e) {
// New translation
return $data;
}
}

foreach ($data->getFields() as $identifier => $hash) {
Expand Down

0 comments on commit 675ea28

Please sign in to comment.