diff --git a/src/Controller/api/v1/PollController.php b/src/Controller/api/v1/PollController.php index a8fe803..d14cb27 100644 --- a/src/Controller/api/v1/PollController.php +++ b/src/Controller/api/v1/PollController.php @@ -245,7 +245,7 @@ class PollController extends EmailsController { $repository = $this->getDoctrine()->getRepository( Poll::class ); $poll = $repository->findOneByCustomUrl( $custom_url ); if ( $poll ) { - throw new \JsonException( 'NOPE, ce sondage existe déjà: '.$custom_url ); + throw new \JsonException( 'NOPE, ce sondage existe déjà: ' . $custom_url ); } $newpoll = new Poll(); @@ -402,21 +402,29 @@ class PollController extends EmailsController { public function testSendCreationMailAction( $emailChoice = 'tktest_commentateur@tktest.com' ) { + $em = $this->getDoctrine()->getRepository( Poll::class ); + $foundPoll = $em->findOneByCustomUrl( 'dessin-anime' ); $em = $this->getDoctrine()->getRepository( Owner::class ); $foundOwner = $em->findOneByEmail( $emailChoice ); - if ( $foundOwner ) { - $sent = $this->sendOwnerPollsAction( $foundOwner ); - if ( $sent ) { - $config = [ - 'owner' => $foundOwner, - 'title' => $this->getParameter( 'WEBSITE_NAME' ) . ' | Mes sondages', - 'email_template' => 'emails/owner-list.html.twig', - ]; - return $this->render( 'emails/owner-list.html.twig', $config ); -// return $this->json( [ "message" => "test email sent to " . $foundOwner->getEmail() . "!" ], 200 ); - } - } + return $this->render( 'emails/creation-mail.html.twig', + [ 'poll' => $foundPoll, 'owner' => $foundPoll->getOwner() ] ); + + +// if ( $foundOwner ) { +// $sent = $this->sendOwnerPollsAction( $foundOwner ); +// if ( $sent ) { +// $config = [ +// 'owner' => $foundOwner, +// 'title' => $this->getParameter( 'WEBSITE_NAME' ) . ' | Mes sondages', +// 'email_template' => 'emails/owner-list.html.twig', +// ]; +// return $this->render( 'emails/owner-list.html.twig', $config ); + +// } +// } + +// return $this->json( [ "message" => "test email sent to " . $foundOwner->getEmail() . "!" ], 200 ); // $this->sendMailWithVars( $config ); diff --git a/templates/email-base.html.twig b/templates/email-base.html.twig index 9f7a8bf..2309a29 100644 --- a/templates/email-base.html.twig +++ b/templates/email-base.html.twig @@ -9,9 +9,9 @@
{% block title %} {% if title is defined %} -

{{ title }}

+

{{ title }}

{% else %} -

Framadate - email

+

Framadate

{% endif %}
{% endblock %} @@ -30,6 +30,9 @@