public function previewAction($emailId, $lang)
    {
        $class = $this->container->getParameter('lexik_mailer.email_entity.class');
        $email = $this->get('doctrine.orm.entity_manager')->find($class, $emailId);

        if (!$email) {
            throw $this->createNotFoundException(sprintf('No email found for id "%d"', $emailId));
        }

        $preview = $this->get('lexik_mailer.message_preview_generator');
        $preview->getTemplatesPreview($email, $lang);

        return $this->render('LexikMailerBundle:Email:preview.html.twig', array_merge(array(
            'content'  => $preview->get('content'),
            'subject'  => $preview->get('subject'),
            'fromName' => $preview->get('fromName'),
            'errors'   => $preview->getErrors(),
        ), $this->getAdditionalParameters()));
    }
public function previewAction($emailId, $lang)
    {
        $class = $this->container->getParameter('lexik_mailer.email_entity.class');
        $email = $this->get('doctrine.orm.entity_manager')->find($class, $emailId);

        if (!$email) {
            throw $this->createNotFoundException(sprintf('No email found for id "%d"', $emailId));
        }

        $preview = $this->get('lexik_mailer.message_preview_generator');
        $preview->getTemplatesPreview($email, $lang);

        return $this->render('LexikMailerBundle:Email:preview.html.twig', array_merge(array(
            'content'  => $preview->get('content'),
            'subject'  => $preview->get('subject'),
            'fromName' => $preview->get('fromName'),
            'errors'   => $preview->getErrors(),
        ), $this->getAdditionalParameters()));
    }
public function previewAction ( $ emailId , $ lang ) { $ class = $ this -> container -> getParameter ( 'lexik_mailer.email_entity.class' ) ; $ email = $ this -> get ( 'doctrine.orm.entity_manager' ) -> find ( $ class , $ emailId ) ; if ( ! $ email ) { throw $ this -> createNotFoundException ( sprintf ( 'No email found for id "%d"' , $ emailId ) ) ; } $ preview = $ this -> get ( 'lexik_mailer.message_preview_generator' ) ; $ preview -> getTemplatesPreview ( $ email , $ lang ) ; return $ this -> render ( 'LexikMailerBundle:Email:preview.html.twig' , array_merge ( array ( 'content' => $ preview -> get ( 'content' ) , 'subject' => $ preview -> get ( 'subject' ) , 'fromName' => $ preview -> get ( 'fromName' ) , 'errors' => $ preview -> getErrors ( ) , ) , $ this -> getAdditionalParameters ( ) ) ) ; }
Preview an email

@param int $emailId
@param     $lang

@throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
@return \Symfony\Component\HttpFoundation\Response
Preview an email