mirror of
https://framagit.org/tykayn/date-poll-api
synced 2023-08-25 08:23:11 +02:00
⚡ mail service start
This commit is contained in:
parent
99f1584d24
commit
1e9c5074b2
@ -5,14 +5,22 @@ namespace App\Service;
|
||||
|
||||
|
||||
use App\Entity\Owner;
|
||||
use App\Entity\Poll;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Swift_Message;
|
||||
|
||||
class MailService {
|
||||
|
||||
|
||||
public function sendCreationMailAction( $foundOwner, $newpoll, \Swift_Mailer $mailer ) {
|
||||
$em = $this->getDoctrine()->getRepository( Owner::class );
|
||||
$admin_user = $em->find( 1 );
|
||||
$poll = $admin_user->getPolls()[ 0 ];
|
||||
public function __construct(EntityManagerInterface $entityManager) {
|
||||
$this->em = $entityManager;
|
||||
}
|
||||
|
||||
public function sendCreationMailAction( Owner $foundOwner, Poll $newpoll, \Swift_Mailer $mailer ) {
|
||||
$em = $this->em->getRepository( Owner::class );
|
||||
$admin_user = $foundOwner;
|
||||
$poll = $newpoll;
|
||||
|
||||
|
||||
// anti spam , limit to every minute
|
||||
@ -30,7 +38,6 @@ class MailService {
|
||||
$templateVars = [
|
||||
'owner' => $admin_user,
|
||||
'poll' => $poll,
|
||||
'url' => $poll->getCustomUrl(),
|
||||
'title' => 'Création de sondage - ' . $poll->getTitle(),
|
||||
'email_template' => 'emails/creation-mail.html.twig',
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user