fix patch 4.1.5 3604

This commit is contained in:
aynsix
2021-12-20 09:45:50 +03:00
parent 94a0dc8f32
commit 1f3e4c655f

View File

@@ -3,6 +3,7 @@
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Model\Repositories\FeedItemRepository;
use Alchemy\Phrasea\Model\Entities\FeedItem;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class patch_415PHRAS3604 implements patchInterface
{
@@ -71,7 +72,12 @@ class patch_415PHRAS3604 implements patchInterface
/** @var FeedItem $feedItem */
foreach ($feedItemRepository->findAll() as $feedItem) {
// if the record is not found, delete the feedItem
if ($app->findDataboxById($feedItem->getSbasId())->getRecordRepository()->find($feedItem->getRecordId()) == null) {
try {
if ($app->findDataboxById($feedItem->getSbasId())->getRecordRepository()->find($feedItem->getRecordId()) == null) {
$app['orm.em']->remove($feedItem);
}
} catch (NotFoundHttpException $e) {
// the referenced sbas_id is not found, so delete also the feedItem
$app['orm.em']->remove($feedItem);
}
}