Total Complexity | 7 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | class FileInfoCacheHelper |
||
21 | { |
||
22 | private EntityManagerInterface $entityManager; |
||
23 | private ObjectRepository $repository; |
||
24 | |||
25 | public function __construct(EntityManagerInterface $entityManager) |
||
29 | } |
||
30 | |||
31 | public function saveCache(FileInfo $fileInfo): void |
||
35 | } |
||
36 | |||
37 | public function deleteCaches(array $paths, array $filters): void |
||
38 | { |
||
39 | foreach ($paths as $path) { |
||
40 | foreach ($filters as $filter) { |
||
41 | $metadata = $this->repository->findOneBy([ |
||
42 | 'path' => $path, |
||
43 | 'filter' => $filter, |
||
44 | ]); |
||
45 | if ($metadata) { |
||
46 | $this->entityManager->remove($metadata); |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 | $this->entityManager->flush(); |
||
51 | } |
||
52 | |||
53 | public function resolveCache(string $path, string $filter): ?FileInfo |
||
60 | ] |
||
61 | ); |
||
64 |