@@ -10,33 +10,33 @@ |
||
| 10 | 10 | class FileService |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - public function __construct( |
|
| 13 | + public function __construct( |
|
| 14 | 14 | private EntityManagerInterface $manager, |
| 15 | 15 | private DomainService $domainService |
| 16 | 16 | |
| 17 | - ) {} |
|
| 17 | + ) {} |
|
| 18 | 18 | |
| 19 | 19 | |
| 20 | - public function getFileUrl(People $people): ?array |
|
| 21 | - { |
|
| 20 | + public function getFileUrl(People $people): ?array |
|
| 21 | + { |
|
| 22 | 22 | if ($people->getImage() instanceof File) |
| 23 | - return [ |
|
| 23 | + return [ |
|
| 24 | 24 | 'id' => $people->getImage()->getId(), |
| 25 | 25 | 'domain' => $this->domainService->getMainDomain(), |
| 26 | 26 | 'url' => '/files/' . $people->getImage()->getId() . '/download' |
| 27 | - ]; |
|
| 27 | + ]; |
|
| 28 | 28 | |
| 29 | 29 | return null; |
| 30 | - } |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - public function addFile(People $people, string $content, string $context, ?string $fileName = null, ?string $fileType = null, ?string $extension = null): File |
|
| 33 | - { |
|
| 32 | + public function addFile(People $people, string $content, string $context, ?string $fileName = null, ?string $fileType = null, ?string $extension = null): File |
|
| 33 | + { |
|
| 34 | 34 | return $this->manager->getRepository(File::class)->addFile($people, $content, $context, $fileName, $fileType, $extension); |
| 35 | - } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - public function removeFile(File $file) |
|
| 38 | - { |
|
| 37 | + public function removeFile(File $file) |
|
| 38 | + { |
|
| 39 | 39 | $this->manager->remove($file); |
| 40 | 40 | $this->manager->flush(); |
| 41 | - } |
|
| 41 | + } |
|
| 42 | 42 | } |