Skip to content

Commit 686d82c

Browse files
committed
Merge branch '6.1' into 6.2
* 6.1: Remove reference of Swift Mailer
2 parents 2a70122 + ed4a18e commit 686d82c

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

controller/soap_web_service.rst

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,27 @@ In this case, the SOAP service will allow the client to call a method called
2727
// src/Service/HelloService.php
2828
namespace App\Service;
2929

30+
use Symfony\Component\Mailer\MailerInterface;
31+
use Symfony\Component\Mime\Email;
32+
3033
class HelloService
3134
{
32-
private $mailer;
35+
private MailerInterface $mailer;
3336

34-
public function __construct(\Swift_Mailer $mailer)
37+
public function __construct(MailerInterface $mailer)
3538
{
3639
$this->mailer = $mailer;
3740
}
3841

39-
public function hello($name)
42+
public function hello(string $name): string
4043
{
41-
$message = (new \Swift_Message('Hello Service'))
42-
->setTo('me@example.com')
43-
->setBody($name.' says hi!');
44+
$email = (new Email())
45+
->from('admin@example.com')
46+
->to('me@example.com')
47+
->subject('Hello Service')
48+
->text($name.' says hi!');
4449

45-
$this->mailer->send($message);
50+
$this->mailer->send($email);
4651

4752
return 'Hello, '.$name;
4853
}

0 commit comments

Comments
 (0)