feat: download ZIP archive of invoices with status 'paid'
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Controller\Common;
|
||||
|
||||
use App\Entity\Upload;
|
||||
use App\Service\Upload\UploadHandler;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
|
||||
@@ -17,6 +18,7 @@ class DownloadController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly UploadHandler $uploadHandler,
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly LoggerInterface $logger
|
||||
) {
|
||||
}
|
||||
@@ -31,6 +33,13 @@ class DownloadController extends AbstractController
|
||||
$inline = (bool) $request->get('inline');
|
||||
$disposition = $inline ? ResponseHeaderBag::DISPOSITION_INLINE : ResponseHeaderBag::DISPOSITION_ATTACHMENT;
|
||||
|
||||
// mark file downloaded
|
||||
$upload
|
||||
->setDownloaded()
|
||||
->setDownloadedBy($this->getUser()->getUserIdentifier())
|
||||
;
|
||||
$this->entityManager->flush();
|
||||
|
||||
$this->logger->info('Download file', [
|
||||
'file_id' => $upload->getId(),
|
||||
'file_filename' => $upload->getOriginalFilename(),
|
||||
|
||||
Reference in New Issue
Block a user