12 use Magento\Downloadable\Model\SampleFactory;
31 private $downloadableFile;
36 private $objectCopyService;
41 private $dataObjectHelper;
46 private $componentFactory;
62 File $downloadableFile,
63 Copy $objectCopyService,
65 SampleFactory $componentFactory
67 $this->downloadableFile = $downloadableFile;
68 $this->objectCopyService = $objectCopyService;
70 $this->componentFactory = $componentFactory;
98 $this->dataObjectHelper->populateWithArray(
104 SampleInterface::class
107 if (!isset($this->data[
'file'])) {
108 throw new \Magento\Framework\Exception\LocalizedException(
__(
'Sample file not provided'));
110 $fileName = $this->downloadableFile->moveFileFromTmp(
128 private function resetData()
136 private function getComponent()
138 if (!$this->component) {
139 $this->component = $this->componentFactory->create();
141 return $this->component;
build(SampleInterface $sample)
setSampleFile($sampleFile)
__construct(File $downloadableFile, Copy $objectCopyService, DataObjectHelper $dataObjectHelper, SampleFactory $componentFactory)