⚡ 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\Owner;
|
||||||
|
use App\Entity\Poll;
|
||||||
|
use Doctrine\ORM\EntityManager;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Swift_Message;
|
||||||
|
|
||||||
class MailService {
|
class MailService {
|
||||||
|
|
||||||
|
|
||||||
public function sendCreationMailAction( $foundOwner, $newpoll, \Swift_Mailer $mailer ) {
|
public function __construct(EntityManagerInterface $entityManager) {
|
||||||
$em = $this->getDoctrine()->getRepository( Owner::class );
|
$this->em = $entityManager;
|
||||||
$admin_user = $em->find( 1 );
|
}
|
||||||
$poll = $admin_user->getPolls()[ 0 ];
|
|
||||||
|
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
|
// anti spam , limit to every minute
|
||||||
|
@ -30,7 +38,6 @@ class MailService {
|
||||||
$templateVars = [
|
$templateVars = [
|
||||||
'owner' => $admin_user,
|
'owner' => $admin_user,
|
||||||
'poll' => $poll,
|
'poll' => $poll,
|
||||||
'url' => $poll->getCustomUrl(),
|
|
||||||
'title' => 'Création de sondage - ' . $poll->getTitle(),
|
'title' => 'Création de sondage - ' . $poll->getTitle(),
|
||||||
'email_template' => 'emails/creation-mail.html.twig',
|
'email_template' => 'emails/creation-mail.html.twig',
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in New Issue