From 10bd80bc73d00135ad068fcd9f90d3ba0190c816 Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Tue, 20 Jun 2017 10:29:14 -0400 Subject: [PATCH] Wrap the instantiation in parenthesis, and chain away --- email.rst | 3 ++- email/dev_environment.rst | 3 ++- email/testing.rst | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/email.rst b/email.rst index e2eff022501..d98e60dae95 100644 --- a/email.rst +++ b/email.rst @@ -103,7 +103,7 @@ an email is pretty straightforward:: public function indexAction($name) { - $message = new \Swift_Message('Hello Email') + $message = (new \Swift_Message('Hello Email')) ->setFrom('send@example.com') ->setTo('recipient@example.com') ->setBody( @@ -125,6 +125,7 @@ an email is pretty straightforward:: ) */ ; + $this->get('mailer')->send($message); return $this->render(...); diff --git a/email/dev_environment.rst b/email/dev_environment.rst index b62be5195ef..dcca77b2ee0 100644 --- a/email/dev_environment.rst +++ b/email/dev_environment.rst @@ -100,7 +100,7 @@ Now, suppose you're sending an email to ``recipient@example.com``. public function indexAction($name) { - $message = new \Swift_Message('Hello Email') + $message = (new \Swift_Message('Hello Email')) ->setFrom('send@example.com') ->setTo('recipient@example.com') ->setBody( @@ -110,6 +110,7 @@ Now, suppose you're sending an email to ``recipient@example.com``. ) ) ; + $this->get('mailer')->send($message); return $this->render(...); diff --git a/email/testing.rst b/email/testing.rst index ca29af4afc8..d7b40dbfa0f 100644 --- a/email/testing.rst +++ b/email/testing.rst @@ -14,7 +14,7 @@ Start with an easy controller action that sends an email:: public function sendEmailAction($name) { - $message = new \Swift_Message('Hello Email') + $message = (new \Swift_Message('Hello Email')) ->setFrom('send@example.com') ->setTo('recipient@example.com') ->setBody('You should see me from the profiler!')