Phalcon\Mailer\Message::createAttachmentViaPath PHP Method

createAttachmentViaPath() protected method

Create a Swift new Attachment from a filesystem path.
See also: Swift_Attachment::fromPath()
protected createAttachmentViaPath ( string $file ) : Swift_Attachment
$file string
return Swift_Attachment
    protected function createAttachmentViaPath($file)
    {
        /** @var $byteStream \Swift_ByteStream_FileByteStream */
        $byteStream = $this->getManager()->getDI()->get('\\Swift_ByteStream_FileByteStream', [$file]);
        /** @var $image \Swift_Attachment */
        $attachment = $this->getManager()->getDI()->get('\\Swift_Attachment')->setFile($byteStream);
        return $attachment;
    }