src/Controller/LogoController.php line 22
<?phpnamespace App\Controller;use App\Entity\Mailling;use App\Service\Utilitaire\AnomalieGestion;use Doctrine\ORM\EntityManagerInterface;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\HttpFoundation\ResponseHeaderBag;use Symfony\Component\HttpKernel\KernelInterface;use Symfony\Component\Routing\Annotation\Route;class LogoController extends AbstractController{private EntityManagerInterface $em;public function __construct(EntityManagerInterface $em){$this->em = $em;}#[Route("/logo/clients/{nom}", methods: ["GET"], name: "get.logo.client")]public function getLogoClientAction($nom, Request $request, KernelInterface $kernel, AnomalieGestion $anomalieGestion){$file = $kernel->getProjectDir() . '/public/logoClients/resized/'.$nom;if(file_exists($file)) {$response = new Response();$disposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_INLINE, $nom);$response->headers->set('Content-Disposition', $disposition);$response->headers->set('Content-Type', 'image/jpeg');$response->setContent(file_get_contents($file));return $response;} else {$anomalieGestion->addAnomalieDemandeDeLogoInexistant($nom);}}#[Route("/logo/pieceJointe/{id}/{nom}", methods: ["GET"], name: "get.piece.jointe")]public function getPieceJointeAction($id, $nom, Request $request, KernelInterface $kernel, AnomalieGestion $anomalieGestion){/** @var Mailling $mailling */$mailling = $this->em->getRepository(Mailling::class)->find($id);$file =$kernel->getProjectDir() . '/public/maillings/'. $mailling->getAncienId() . '/' . $nom;if(file_exists($file)) {$response = new Response();$disposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_INLINE, $nom);$response->headers->set('Content-Disposition', $disposition);$response->headers->set('Content-Type', 'pdf');$response->setContent(file_get_contents($file));return $response;} else {$anomalieGestion->addAnomalieDemandeDePiecJointeInexistant($nom);}}#[Route("/logo/coupurepieceJointe/{nom}", methods: ["GET"], name: "get.piece.jointe")]public function getCoupurePieceJointeAction($nom, Request $request, KernelInterface $kernel, AnomalieGestion $anomalieGestion){/** @var Mailling $mailling */$file =$kernel->getProjectDir() . '/public/coupures/'. $nom;if(file_exists($file)) {$response = new Response();$disposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_INLINE, $nom);$response->headers->set('Content-Disposition', $disposition);$response->headers->set('Content-Type', 'pdf');$response->setContent(file_get_contents($file));return $response;} else {$anomalieGestion->addAnomalieDemandeDePiecJointeInexistant($nom);}}#[Route("/logo/supports/{nom}", methods: ["GET"], name: "get.logo.support")]public function getLogoSupportAction($nom, Request $request, KernelInterface $kernel, AnomalieGestion $anomalieGestion){$file = $kernel->getProjectDir() . '/public/logoSupports/'.$nom;if(file_exists($file)) {$response = new Response();$disposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_INLINE, $nom);$response->headers->set('Content-Disposition', $disposition);$response->headers->set('Content-Type', 'image/jpeg');$response->setContent(file_get_contents($file));return $response;} else {$anomalieGestion->addAnomalieDemandeDeLogoInexistant($nom);}}}