ref 3016. Updated ogRepository sync
ogcore-debian-package/pipeline/head This commit looks good Details
testing/ogcore-api/pipeline/head There was a failure building this commit Details

pull/125/head
Manuel Aranda Rosales 2026-07-17 11:44:30 +02:00
parent 1b24414c0c
commit 52515633af
1 changed files with 12 additions and 0 deletions

View File

@ -80,6 +80,18 @@ class SyncAction extends AbstractOgRepositoryController
$this->entityManager->flush();
$orphanImages = $imageRepo->createQueryBuilder('i')
->leftJoin('i.imageImageRepositories', 'iir')
->andWhere('iir.id IS NULL')
->getQuery()
->getResult();
foreach ($orphanImages as $orphanImage) {
$this->entityManager->remove($orphanImage);
}
$this->entityManager->flush();
return new JsonResponse(data: $content, status: Response::HTTP_OK);
}