Fatal error: Class 'Acme\RentacarBundle\Service\Swift_Encoding' not found in ...
___________________

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class MailService
{
    /**
     * @var \Swift_Mailer
     */
    private $mailer;

    /**
     * @var \Twig_Environment
     */
    private $twig;

    /**
     * Constructor.
     *
     * @param \Swift_Mailer $mailer
     * @param \Twig_Environment
     */
    public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig)
    {
        $this->mailer = $mailer;
        $this->twig = $twig;
    }

    /**
     * Send reservation mail.
     *
     * @param Reservation $reservation
     * @param User $user
     */
    public function sendReservationMail(Reservation $reservation, User $user)
    {
        $body = $this->render('AcmeRentacarBundle:Mail:reservation.txt.twig', array(
            'reservation' => $reservation,
            'user'        => $user,
        ));

        $message = \Swift_Message::newInstance()
            ->setSubject('Subject in mylanguage')
            ->setFrom(array('noreply@example.com' => 'SymfonyUser'))
            ->setTo($user->getEmail())
            ->setBody($body)
        ;
        $message->setCharset('iso-2022-jp');
        $message->setEncoder(Swift_Encoding::get7BitEncoding());

        $this->mailer->send($message);
    }...
Eclaire moi SVP.

Je vous rémercie d'avance.
______________________
PHP 5.4.3 Symfony 2.0.15