Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Small image URL added to the product data #132

Merged
merged 19 commits into from
Sep 26, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Magento\Catalog\Helper\ImageFactory as CatalogImageHelperFactory;
use Magento\Catalog\Model\Product;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;

Expand Down Expand Up @@ -43,7 +44,7 @@ public function resolve(
array $args = null
): array {
if (!isset($value['model'])) {
throw new \LogicException(__("Cannot resolve entity model"));
throw new GraphQlInputException(__('"model" value should be specified'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Client knows nothing about the model. It must be passed from the parent resolver. I think before the change we had correct exception, the only change I would made is remove translation:
throw new \LogicException("Cannot resolve entity model");

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#189
Has been created

}
/** @var Product $product */
$product = $value['model'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ public function testCategoryProducts()
}
short_description
sku
small_image
small_image {
path
}
small_image_label
special_from_date
special_price
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ public function testQueryAllFieldsSimpleProduct()
}
short_description
sku
small_image
small_image {
path
}
small_image_label
special_from_date
special_price
Expand Down Expand Up @@ -484,7 +486,7 @@ public function testQueryMediaGalleryEntryFieldsSimpleProduct()
QUERY;

$response = $this->graphQlQuery($query);

/**
* @var ProductRepositoryInterface $productRepository
*/
Expand Down