PHRAS-3604 remove deleted record from a publication

This commit is contained in:
aynsix
2021-12-08 15:51:49 +03:00
parent 43132f453c
commit bc17030f9d
4 changed files with 165 additions and 94 deletions

View File

@@ -32,6 +32,7 @@ use Alchemy\Phrasea\Media\TechnicalData;
use Alchemy\Phrasea\Media\TechnicalDataSet;
use Alchemy\Phrasea\Metadata\Tag\TfBasename;
use Alchemy\Phrasea\Metadata\Tag\TfFilename;
use Alchemy\Phrasea\Model\Repositories\FeedItemRepository;
use Alchemy\Phrasea\Model\Entities\OrderElement;
use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Model\RecordInterface;
@@ -2146,6 +2147,14 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
$this->app['orm.em']->remove($basket_element);
}
/** @var FeedItemRepository $feedItemRepository */
$feedItemRepository = $this->app['repo.feed-items'];
// remove the record from publications
foreach($feedItemRepository->findBy(['recordId' => $this->getRecordId()]) as $feedItem) {
$this->app['orm.em']->remove($feedItem);
}
$this->app['orm.em']->flush();
$this->app['filesystem']->remove($ftodel);