Skip to content

Commit 19dbdde

Browse files
author
Alex Paliarush
committed
MAGETWO-92773: [GraphQL] Products cannot be fetched in parent/anchor category #89
1 parent 4431b56 commit 19dbdde

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

app/code/Magento/CatalogGraphQl/Model/Resolver/Category.php renamed to app/code/Magento/CatalogGraphQl/Model/Resolver/Categories.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
use Magento\Framework\Reflection\DataObjectProcessor;
2121

2222
/**
23-
* Resolver for categoriy objects the product is assigned to.
23+
* Resolver for category objects the product is assigned to.
2424
*/
25-
class Category implements ResolverInterface
25+
class Categories implements ResolverInterface
2626
{
2727
/**
2828
* @var Collection

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/FilterArgument/ProductEntityAttributesForAst.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ class ProductEntityAttributesForAst implements FieldEntityAttributesInterface
2525
/**
2626
* @var array
2727
*/
28-
private $additionalAttributes;
28+
private $additionalAttributes = ['min_price', 'max_price', 'category_id'];
2929

3030
/**
3131
* @param ConfigInterface $config
3232
* @param array $additionalAttributes
3333
*/
3434
public function __construct(
3535
ConfigInterface $config,
36-
array $additionalAttributes = ['min_price', 'max_price', 'category_id']
36+
array $additionalAttributes = []
3737
) {
3838
$this->config = $config;
39-
$this->additionalAttributes = $additionalAttributes;
39+
$this->additionalAttributes = array_merge($this->additionalAttributes, $additionalAttributes);
4040
}
4141

4242
/**

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\
278278
price: ProductPrices @doc(description: "A ProductPrices object, indicating the price of an item") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\Price")
279279
gift_message_available: String @doc(description: "Indicates whether a gift message is available")
280280
manufacturer: Int @doc(description: "A number representing the product's manufacturer")
281-
categories: [CategoryInterface] @doc(description: "The categories assigned to a product") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Category")
281+
categories: [CategoryInterface] @doc(description: "The categories assigned to a product") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Categories")
282282
canonical_url: String @doc(description: "Canonical URL") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\CanonicalUrl")
283283
}
284284

0 commit comments

Comments
 (0)