|
7 | 7 |
|
8 | 8 | namespace Magento\CatalogGraphQl\Model\Resolver\Category; |
9 | 9 |
|
| 10 | +use Magento\Catalog\Model\Category; |
| 11 | +use Magento\Catalog\Model\Category\FileInfo; |
| 12 | +use Magento\Framework\Exception\LocalizedException; |
| 13 | +use Magento\Framework\Filesystem\DirectoryList; |
10 | 14 | use Magento\Framework\GraphQl\Config\Element\Field; |
| 15 | +use Magento\Framework\GraphQl\Exception\GraphQlInputException; |
11 | 16 | use Magento\Framework\GraphQl\Query\ResolverInterface; |
12 | 17 | use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; |
13 | | -use Magento\Framework\Exception\LocalizedException; |
| 18 | +use Magento\Framework\UrlInterface; |
14 | 19 | use Magento\Store\Api\Data\StoreInterface; |
15 | | -use Magento\Framework\Filesystem\DirectoryList; |
16 | | -use Magento\Catalog\Model\Category\FileInfo; |
17 | | -use Magento\Framework\GraphQl\Exception\GraphQlInputException; |
18 | 20 |
|
19 | 21 | /** |
20 | 22 | * Resolve category image to a fully qualified URL |
@@ -52,15 +54,15 @@ public function resolve( |
52 | 54 | if (!isset($value['model'])) { |
53 | 55 | throw new LocalizedException(__('"model" value should be specified')); |
54 | 56 | } |
55 | | - /** @var \Magento\Catalog\Model\Category $category */ |
| 57 | + /** @var Category $category */ |
56 | 58 | $category = $value['model']; |
57 | 59 | $imagePath = $category->getData('image'); |
58 | 60 | if (empty($imagePath)) { |
59 | 61 | return null; |
60 | 62 | } |
61 | 63 | /** @var StoreInterface $store */ |
62 | 64 | $store = $context->getExtensionAttributes()->getStore(); |
63 | | - $baseUrl = $store->getBaseUrl(); |
| 65 | + $baseUrl = $store->getBaseUrl(UrlInterface::URL_TYPE_WEB); |
64 | 66 |
|
65 | 67 | $filenameWithMedia = $this->fileInfo->isBeginsWithMediaDirectoryPath($imagePath) |
66 | 68 | ? $imagePath : $this->formatFileNameWithMediaCategoryFolder($imagePath); |
|
0 commit comments