/** * @inheritdoc */ function create($args) { $download = new Download(); $download->setTitle($args['title']); $download->setText($args['text']); $download->setFile($this->createImage($args['file'])); return $download; }
/** * @param Download|null $originalResource * @return Download|null */ public function duplicate($originalResource) { if (!$originalResource) { return null; } /** @var Download $newDownload */ $newDownload = $this->createNew(); $newDownload->setTitle($originalResource->getTitle()); $newDownload->setText($originalResource->getText()); $newFile = $this->fileFactory->duplicate($originalResource->getFile()); $newDownload->setFile($newFile); return $newDownload; }