Skip to content

Commit

Permalink
Merge pull request #1 from storefront-x/feature/PX-1414
Browse files Browse the repository at this point in the history
PX-1414 loading attributes
  • Loading branch information
bogdanwalek authored Nov 18, 2022
2 parents 8938a5b + 05ab8ea commit 4b5c966
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Model/Resolver/SFXProductAttributesGraphQl.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Magento\Catalog\Model\Product;
use Psr\Log\LoggerInterface;
use StorefrontX\ProductAttributesGraphQl\Model\IgnoredFields;
use Magento\Catalog\Model\ProductRepository;

class SFXProductAttributesGraphQl implements ResolverInterface
{
Expand All @@ -21,13 +22,16 @@ class SFXProductAttributesGraphQl implements ResolverInterface
protected LoggerInterface $logger;
protected array $cachedAttributes = [];
protected IgnoredFields $ignoredFields;
protected ProductRepository $productRepository;

public function __construct(
StoreManagerInterface $storeManager,
ProductRepository $productRepository,
LoggerInterface $logger,
IgnoredFields $ignoredFields
) {
$this->storeManager = $storeManager;
$this->productRepository = $productRepository;
$this->logger = $logger;
$this->ignoredFields = $ignoredFields;
}
Expand All @@ -46,7 +50,8 @@ public function resolve(

$attributesArray = [];
/** @var Product $product */
$product = $value['model'];
$product = $this->productRepository->get($value['sku']);


$attributes = $this->getAttributes($product);
foreach ($attributes as $key => $attribute) {
Expand Down

0 comments on commit 4b5c966

Please sign in to comment.