Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mathieu
potage
Commits
27e2b4c6
Commit
27e2b4c6
authored
Sep 07, 2018
by
Mat
Browse files
newsletter: ajoute une fonction publique qui calcule les variables, appelable depuis la commande
parent
2bdd6151
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/PotageBundle/Command/SendMailCommand.php
View file @
27e2b4c6
...
...
@@ -88,7 +88,7 @@ class SendMailCommand extends ContainerAwareCommand
$retour
=
$this
->
newsletter
->
sendLettre
(
$to
,
"[Docker][Symfony][cli][infolettre][single] Mail de test"
,
$
lettre
$
this
->
newsletter
->
lettreTobody
(
$lettre
)
);
$retourMsg
=
(
$retour
===
1
)
?
"
\e
[1;32mSent
\e
[0m
\n
"
:
"
\e
[1;31mError
\e
[0m
\n
"
;
...
...
src/PotageBundle/Services/Newsletter.php
View file @
27e2b4c6
...
...
@@ -143,6 +143,24 @@ class Newsletter
}
/**
* Besoin d'une fonction publique pour envoyer des mails single via la commande
*
* @param Lettre $lettre
* @return mixed
*/
public
function
lettreTobody
(
Lettre
$lettre
)
{
$lettre
=
$this
->
getBody
(
$lettre
);
$itemsSorted
=
$this
->
getInfosSorted
(
$lettre
);
return
array
(
'lettre'
=>
$lettre
,
'itemsSorted'
=>
$itemsSorted
);
}
/**
* Envoie une infolettre à un destinataire
*
...
...
@@ -188,8 +206,10 @@ class Newsletter
*/
public
function
sendLettreToGroup
(
Lettre
$lettre
)
{
$subject
=
$lettre
->
getSubject
();
$body
=
$this
->
lettreTobody
(
$lettre
);
/**
* @var Offre $offre
* @var Groupe $groupe
...
...
@@ -197,13 +217,6 @@ class Newsletter
$offre
=
$lettre
->
getOffre
();
$groupe
=
$lettre
->
getGroupe
();
$lettre
=
$this
->
getBody
(
$lettre
);
$itemsSorted
=
$this
->
getInfosSorted
(
$lettre
);
$body
=
array
(
'lettre'
=>
$lettre
,
'itemsSorted'
=>
$itemsSorted
);
/**
* Les destinataires du groupe de l'infolettre,
* un tableau d'utilisteurs
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment