mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 06:53:15 +00:00
fix patch 4.1.5 3604
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user