Permalink
Browse files

minor #4808 Email message instantiation changed to a more 'symfonysh'…

… way. (alebo)

This PR was merged into the 2.3 branch.

Discussion
----------

Email message instantiation changed to a more 'symfonysh' way.

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | all
| Fixed tickets |

I believe that using a static factory method for instantiation isn't the best way to do it in Symfony. So I suggest updating the Sending Emails example.

Commits
-------

7f8b051 Changed email message instantiation to a more 'symfonysh' way.
  • Loading branch information...
wouterj committed Jan 16, 2015
2 parents e913808 + 7f8b051 commit 892586bf3ceb5c9f8c1e0f5e3cfa0a5100628161
Showing with 3 additions and 2 deletions.
  1. +3 −2 cookbook/email/email.rst
@@ -103,7 +103,8 @@ an email is pretty straightforward::
public function indexAction($name)
{
$message = \Swift_Message::newInstance()
$mailer = $this->get('mailer');
$message = $mailer->createMessage()
->setSubject('Hello Email')
->setFrom('send@example.com')
->setTo('recipient@example.com')
@@ -114,7 +115,7 @@ an email is pretty straightforward::
)
)
;
$this->get('mailer')->send($message);
$mailer->send($message);
return $this->render(...);
}

0 comments on commit 892586b

Please sign in to comment.