/** * @param Attachment $attachment * @return void */ public function addAttachment(Attachment $attachment) { /** @var \League\Flysystem\Adapter\AbstractAdapter $adapter */ $adapter = $this->storage->getAdapter(); $attachmentPath = 'attachments' . DIRECTORY_SEPARATOR . $attachment->getName(); $this->storage->put($attachmentPath, $attachment->getContent()); $this->attachments[$attachmentPath] = $adapter->getPathPrefix() . $attachmentPath; }
/** * @param Attachment $attachment * @return void */ public function addAttachment(Attachment $attachment) { $this->attachments[] = ['type' => $attachment->getType(), 'name' => $attachment->getName(), 'content' => base64_encode($attachment->getContent())]; }