DEV Community

Sonia-dev
Sonia-dev

Posted on

Call to a member function render() on null in Symfony4

public function notify(Contact $contact){

        // Create the message
        $message= ( new \Swift_Message( 'centre : ' . $contact ->getFirstname()))
        ->setFrom('noreply@server.com')
        ->setTo('benabdallahsonia16@gmail.com')
        ->setReplyTo($contact->getEmail())
        ->setBody($this->renderer -> render('emails/contact.html.twig' , [
            'contact'=>$contact ,
        ]), 'text/html'
        );
        $this ->mailer->send($message);



    }
Enter fullscreen mode Exit fullscreen mode

Top comments (0)