Adapter attachment upload forms to the new system

This commit is contained in:
Jan Böhmer 2024-03-03 18:52:06 +01:00
parent 0c33059c4e
commit 3585b8a56a
7 changed files with 32 additions and 22 deletions

View file

@ -24,6 +24,7 @@ namespace App\Controller\AdminPages;
use App\DataTables\LogDataTable;
use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentUpload;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Base\AbstractNamedDBElement;
use App\Entity\Base\AbstractPartsContainingDBElement;
@ -175,16 +176,10 @@ abstract class BaseAdminController extends AbstractController
$attachments = $form['attachments'];
foreach ($attachments as $attachment) {
/** @var FormInterface $attachment */
$options = [
'secure_attachment' => $attachment['secureFile']->getData(),
'download_url' => $attachment['downloadURL']->getData(),
];
try {
$this->attachmentSubmitHandler->handleFormSubmit(
$this->attachmentSubmitHandler->handleUpload(
$attachment->getData(),
$attachment['file']->getData(),
$options
AttachmentUpload::fromAttachmentForm($attachment)
);
} catch (AttachmentDownloadException $attachmentDownloadException) {
$this->addFlash(
@ -270,10 +265,9 @@ abstract class BaseAdminController extends AbstractController
];
try {
$this->attachmentSubmitHandler->handleFormSubmit(
$this->attachmentSubmitHandler->handleUpload(
$attachment->getData(),
$attachment['file']->getData(),
$options
AttachmentUpload::fromAttachmentForm($attachment)
);
} catch (AttachmentDownloadException $attachmentDownloadException) {
$this->addFlash(