public function fromEmail(Email $emailEntity)
    {
        $message = (new \Swift_Message())
            ->setSubject($emailEntity->getSubject())
            ->setTo([$emailEntity->getTargetMail()])
            ->setFrom($emailEntity->getFrom())
            ->setBody($emailEntity->getBodyHtml(), 'text/html')
            ->addPart($emailEntity->getBodyText(), 'text/plain');

        foreach ($emailEntity->getAttachments() as $name => $attachment) {
            $message->attach(AttachmentManager::buildSwift($attachment, $name));
        }

        return $message;
    }
public function fromEmail(Email $emailEntity)
    {
        $message = (new \Swift_Message())
            ->setSubject($emailEntity->getSubject())
            ->setTo([$emailEntity->getTargetMail()])
            ->setFrom($emailEntity->getFrom())
            ->setBody($emailEntity->getBodyHtml(), 'text/html')
            ->addPart($emailEntity->getBodyText(), 'text/plain');

        foreach ($emailEntity->getAttachments() as $name => $attachment) {
            $message->attach(AttachmentManager::buildSwift($attachment, $name));
        }

        return $message;
    }
public function fromEmail ( Email $ emailEntity ) { $ message = ( new \ Swift_Message ( ) ) -> setSubject ( $ emailEntity -> getSubject ( ) ) -> setTo ( [ $ emailEntity -> getTargetMail ( ) ] ) -> setFrom ( $ emailEntity -> getFrom ( ) ) -> setBody ( $ emailEntity -> getBodyHtml ( ) , 'text/html' ) -> addPart ( $ emailEntity -> getBodyText ( ) , 'text/plain' ) ; foreach ( $ emailEntity -> getAttachments ( ) as $ name => $ attachment ) { $ message -> attach ( AttachmentManager :: buildSwift ( $ attachment , $ name ) ) ; } return $ message ; }
Transforms an Email entity to a Swift_Message.

@param \ProjetNormandie\EmailBundle\Entity\Email $emailEntity
@return \Swift_Message
Transforms an Email entity to a Swift_Message .