/** * Clone for attachment * * @param \XLite\Module\CDev\FileAttachments\Model\Product\Attachment $attachment Attachment * * @return \XLite\Model\AEntity */ public function cloneEntityForAttachment(\XLite\Module\CDev\FileAttachments\Model\Product\Attachment $attachment) { $newStorage = parent::cloneEntity(); $attachment->setStorage($newStorage); $newStorage->setAttachment($attachment); $newStorage->setPath(''); $newStorage->loadFromURL(parent::getURL(), true); return $newStorage; }
/** * Format attachment model * * @param \XLite\Module\CDev\FileAttachments\Model\Product\Attachment $attachment Attachment * * @return string */ protected function formatAttachmentModel(\XLite\Module\CDev\FileAttachments\Model\Product\Attachment $attachment) { return $this->formatStorageModel($attachment->getStorage(), $attachment->getPrivate() ?: null); }