|
|
@@ -13,6 +13,7 @@ use App\Entity\Organization\Organization;
|
|
|
use App\Entity\Person\Person;
|
|
|
use App\Enum\Core\FileTypeEnum;
|
|
|
use App\Enum\Core\FileVisibilityEnum;
|
|
|
+use App\Repository\Core\FileRepository;
|
|
|
use App\Service\File\Exception\FileNotFoundException;
|
|
|
use App\Service\File\Factory\ImageFactory;
|
|
|
use App\Service\File\Storage\FileStorageInterface;
|
|
|
@@ -32,6 +33,7 @@ class FileManager
|
|
|
protected readonly ImageFactory $imageFactory,
|
|
|
protected readonly LocalStorage $localStorage,
|
|
|
protected readonly EntityManagerInterface $entityManager,
|
|
|
+ protected readonly FileRepository $fileRepository,
|
|
|
) {
|
|
|
}
|
|
|
|
|
|
@@ -153,15 +155,7 @@ class FileManager
|
|
|
$storageService->deleteOrganizationFiles($organizationId);
|
|
|
}
|
|
|
|
|
|
- $qb = $this->entityManager->createQueryBuilder();
|
|
|
- $qb
|
|
|
- ->delete(File::class, 'f')
|
|
|
- ->where(
|
|
|
- $qb->expr()->eq('f.organization', ':organizationId')
|
|
|
- )
|
|
|
- ->setParameter('organizationId', $organizationId)
|
|
|
- ->getQuery()
|
|
|
- ->execute();
|
|
|
+ $this->fileRepository->deleteByOrganization($organizationId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -177,14 +171,6 @@ class FileManager
|
|
|
$storageService->deletePersonFiles($personId);
|
|
|
}
|
|
|
|
|
|
- $qb = $this->entityManager->createQueryBuilder();
|
|
|
- $qb
|
|
|
- ->delete(File::class, 'f')
|
|
|
- ->where(
|
|
|
- $qb->expr()->eq('f.person', ':$personId')
|
|
|
- )
|
|
|
- ->setParameter('$personId', $personId)
|
|
|
- ->getQuery()
|
|
|
- ->execute();
|
|
|
+ $this->fileRepository->deleteByPerson($personId);
|
|
|
}
|
|
|
}
|