Show attachments in part info

WIP: viewing and downloading attachments is not possible yet.
This commit is contained in:
Jan Böhmer 2019-08-06 18:47:09 +02:00
parent 717b257778
commit 01a83d388b
8 changed files with 269 additions and 16 deletions

View file

@ -34,6 +34,7 @@ use App\Entity\Category;
use App\Entity\Part;
use App\Form\PartType;
use App\Services\AttachmentFilenameService;
use App\Services\AttachmentHelper;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
@ -46,7 +47,7 @@ class PartController extends AbstractController
* @Route("/part/{id}/info", name="part_info")
* @Route("/part/{id}", requirements={"id"="\d+"})
*/
public function show(Part $part, AttachmentFilenameService $attachmentFilenameService)
public function show(Part $part, AttachmentFilenameService $attachmentFilenameService, AttachmentHelper $attachmentHelper)
{
$this->denyAccessUnlessGranted('read', $part);
@ -56,6 +57,7 @@ class PartController extends AbstractController
[
'part' => $part,
'main_image' => $attachmentFilenameService->attachmentPathToAbsolutePath($filename),
'attachment_helper' => $attachmentHelper
]
);
}