Skip to content

Commit b26bb78

Browse files
committed
Remove reference of Swift Mailer
1 parent 4975898 commit b26bb78

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('[email protected]')
43-
->setBody($name.' says hi!');
44+
$email = (new Email())
45+
46+
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)