Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SelectProcessor.php
Go to the documentation of this file.
1 <?php
7 
14 
19 {
23  private $resource;
24 
28  private $metadataPool;
29 
33  private $storeManager;
34 
40  public function __construct(
41  MetadataPool $metadataPool,
42  ResourceConnection $resource,
43  StoreManagerInterface $storeManager
44  ) {
45  $this->metadataPool = $metadataPool;
46  $this->resource = $resource;
47  $this->storeManager = $storeManager;
48  }
49 
55  public function process(Select $select)
56  {
57  $linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
58  $select->joinInner(
59  ['pw' => $this->resource->getTableName('catalog_product_website')],
60  'pw.product_id = ' . BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS . '.' . $linkField
61  . ' AND pw.website_id = ' . $this->storeManager->getWebsite()->getId(),
62  []
63  );
64 
65  return $select;
66  }
67 }
$storeManager
$resource
Definition: bulk.php:12
__construct(MetadataPool $metadataPool, ResourceConnection $resource, StoreManagerInterface $storeManager)