Skip to content

Commit 05f093e

Browse files
committed
Merge branch '2.3-develop#710' of github.com:XxXgeoXxX/graphql-ce into 2.3-develop#710
2 parents 5027a80 + f8f5470 commit 05f093e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

app/code/Magento/DownloadableGraphQl/Model/Resolver/Product/DownloadableOptions.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
use Magento\Framework\GraphQl\Config\Element\Field;
2020
use Magento\Framework\GraphQl\Query\EnumLookup;
2121
use Magento\Framework\GraphQl\Query\ResolverInterface;
22+
use Magento\Framework\App\ObjectManager;
23+
use Magento\Framework\UrlInterface;
2224

2325
/**
2426
* @inheritdoc
@@ -47,22 +49,30 @@ class DownloadableOptions implements ResolverInterface
4749
*/
4850
private $linkCollection;
4951

52+
/**
53+
* @var UrlInterface
54+
*/
55+
private $urlBuilder;
56+
5057
/**
5158
* @param EnumLookup $enumLookup
5259
* @param DownloadableHelper $downloadableHelper
5360
* @param SampleCollection $sampleCollection
5461
* @param LinkCollection $linkCollection
62+
* @param UrlInterface|null $urlBuilder
5563
*/
5664
public function __construct(
5765
EnumLookup $enumLookup,
5866
DownloadableHelper $downloadableHelper,
5967
SampleCollection $sampleCollection,
60-
LinkCollection $linkCollection
68+
LinkCollection $linkCollection,
69+
UrlInterface $urlBuilder = null
6170
) {
6271
$this->enumLookup = $enumLookup;
6372
$this->downloadableHelper = $downloadableHelper;
6473
$this->sampleCollection = $sampleCollection;
6574
$this->linkCollection = $linkCollection;
75+
$this->urlBuilder = $urlBuilder ?: ObjectManager::getInstance()->get(UrlInterface::class);
6676
}
6777

6878
/**
@@ -165,7 +175,7 @@ private function formatSamples(Collection $samples) : array
165175
$resultData[$sampleKey]['sort_order'] = $sample->getSortOrder();
166176
$resultData[$sampleKey]['sample_type']
167177
= $this->enumLookup->getEnumValueFromField('DownloadableFileTypeEnum', $sample->getSampleType());
168-
$resultData[$sampleKey]['sample_file'] = $sample->getSampleFile();
178+
$resultData[$sampleKey]['sample_file'] = $this->urlBuilder->getUrl('downloadable/download/sample', ['sample_id' => $sample->getId()]);
169179
$resultData[$sampleKey]['sample_url'] = $sample->getSampleUrl();
170180
}
171181
return $resultData;

0 commit comments

Comments
 (0)