51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Controller;
|
|
|
|
use App\Entity\Mail;
|
|
use App\Entity\Mailing;
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\Routing\Annotation\Route;
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
|
|
|
class MailController extends AbstractController
|
|
{
|
|
/**
|
|
* @Route("/mail/{mailing}/{mail}/show", name="mail_show")
|
|
* @ParamConverter("mail", options={"mapping": {"mail": "id", "mailing": "mailing"}})
|
|
*/
|
|
public function show(Mail $mail): Response
|
|
{
|
|
return $this->render('mail/show.html.twig', [
|
|
'mail' => $mail,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* @Route("/mail/{mailing}/{mail}/html", name="mail_html")
|
|
* @ParamConverter("mail", options={"mapping": {"mail": "id", "mailing": "mailing"}})
|
|
*/
|
|
public function html(Mail $mail): Response
|
|
{
|
|
return $this->render('mail/html.html.twig', [
|
|
'mail' => $mail,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* @Route("/mail/{mailing}/{mail}/text", name="mail_text")
|
|
* @ParamConverter("mail", options={"mapping": {"mail": "id", "mailing": "mailing"}})
|
|
*/
|
|
public function text(Mail $mail): Response
|
|
{
|
|
$response = $this->render('mail/text.html.twig', [
|
|
'mail' => $mail,
|
|
]);
|
|
|
|
$response->headers->set('Content-Type', 'text/plain');
|
|
|
|
return $response;
|
|
}
|
|
}
|