/** * Build file info data object * * @param string $entityType 'link' or 'sample' * @param \Magento\Downloadable\Model\Link|\Magento\Downloadable\Model\Sample $resourceData * @return \Magento\Downloadable\Service\V1\DownloadableLink\Data\DownloadableResourceInfo|null */ protected function entityInfoGenerator($entityType, $resourceData) { $type = $resourceData->getData($entityType . '_type'); if (empty($type)) { return null; } $this->resourceBuilder->populateWithArray([]); $this->resourceBuilder->setType($type); $this->resourceBuilder->setUrl($resourceData->getData($entityType . '_url')); $this->resourceBuilder->setFile($resourceData->getData($entityType . '_file')); return $this->resourceBuilder->create(); }