Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfigurableProductsProvider.php
Go to the documentation of this file.
1 <?php
8 
10 {
14  private $resource;
15 
19  private $productIds = [];
20 
24  public function __construct(\Magento\Framework\App\ResourceConnection $resource)
25  {
26  $this->resource = $resource;
27  }
28 
33  public function getIds(array $ids)
34  {
35  $key = md5(json_encode($ids));
36  if (!isset($this->productIds[$key])) {
37  $connection = $this->resource->getConnection();
38  $this->productIds[$key] = $connection->fetchCol(
40  ->select()
41  ->from(['e' => $this->resource->getTableName('catalog_product_entity')], ['e.entity_id'])
42  ->where('e.type_id = ?', \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE)
43  ->where('e.entity_id IN (?)', $ids)
44  );
45  }
46  return $this->productIds[$key];
47  }
48 }
$resource
Definition: bulk.php:12
$connection
Definition: bulk.php:13