Skip to content

Commit 245d1d8

Browse files
committed
B2B-2404: Optimize Product Permissions in GraphQL resolver
1 parent fe0b9ea commit 245d1d8

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

app/code/Magento/BundleGraphQl/etc/graphql/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@
135135
<argument name="product" xsi:type="object">Magento\BundleGraphQl\Model\Resolver\Products\DataProvider\Deferred\Product\Option</argument>
136136
</arguments>
137137
</type>
138+
<type name="Magento\BundleGraphQl\Model\Resolver\PriceRange">
139+
<arguments>
140+
<argument name="productDataProvider" xsi:type="object">Magento\BundleGraphQl\Model\Resolver\Products\DataProvider\Deferred\Product\Option</argument>
141+
</arguments>
142+
</type>
138143
<virtualType name="Magento\BundleGraphQl\Model\Resolver\Options\Product"
139144
type="Magento\CatalogGraphQl\Model\Resolver\Product">
140145
<arguments>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
namespace Magento\Catalog\Model\ResourceModel\Product;
3+
4+
/**
5+
* Factory class for @see \Magento\Catalog\Model\ResourceModel\Product\Collection
6+
*/
7+
class CollectionFactory
8+
{
9+
/**
10+
* Object Manager instance
11+
*
12+
* @var \Magento\Framework\ObjectManagerInterface
13+
*/
14+
protected $_objectManager = null;
15+
16+
/**
17+
* Instance name to create
18+
*
19+
* @var string
20+
*/
21+
protected $_instanceName = null;
22+
23+
/**
24+
* Factory constructor
25+
*
26+
* @param \Magento\Framework\ObjectManagerInterface $objectManager
27+
* @param string $instanceName
28+
*/
29+
public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, $instanceName = '\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Collection')
30+
{
31+
$this->_objectManager = $objectManager;
32+
$this->_instanceName = $instanceName;
33+
}
34+
35+
/**
36+
* Create class instance with specified parameters
37+
*
38+
* @param array $data
39+
* @return \Magento\Catalog\Model\ResourceModel\Product\Collection
40+
*/
41+
public function create(array $data = [])
42+
{
43+
return $this->_objectManager->create($this->_instanceName, $data);
44+
}
45+
}

0 commit comments

Comments
 (0)