Skip to content

Commit 0dd7583

Browse files
author
Vitaliy Boyko
committed
graphQl-256: fixed issue with array access
1 parent 85d2628 commit 0dd7583

File tree

1 file changed

+5
-2
lines changed
  • app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/Variant

1 file changed

+5
-2
lines changed

app/code/Magento/ConfigurableProductGraphQl/Model/Resolver/Variant/Attributes.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\ConfigurableProductGraphQl\Model\Resolver\Variant;
99

10+
use Magento\Catalog\Model\Product;
1011
use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
1112
use Magento\Framework\GraphQl\Query\Resolver\Value;
1213
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
@@ -45,12 +46,14 @@ public function resolve(
4546
$data = [];
4647
foreach ($value['options'] as $option) {
4748
$code = $option['attribute_code'];
48-
if (!isset($value['product']['model'][$code])) {
49+
/** @var Product|null $model */
50+
$model = $value['product']['model'] ?? null;
51+
if (!$model || !$model->getData($code)) {
4952
continue;
5053
}
5154

5255
foreach ($option['values'] as $optionValue) {
53-
if ($optionValue['value_index'] != $value['product']['model'][$code]) {
56+
if ($optionValue['value_index'] != $model->getData($code)) {
5457
continue;
5558
}
5659
$data[] = [

0 commit comments

Comments
 (0)