/**
  * Copy relations product index from primary index to temporary index table by parent entity
  *
  * @param null|array $parentIds
  * @param array $excludeIds
  * @return \Magento\Catalog\Model\Indexer\Product\Price\AbstractAction
  */
 protected function _copyRelationIndexData($parentIds, $excludeIds = null)
 {
     $select = $this->_connection->select()->from($this->_defaultIndexerResource->getTable('catalog_product_relation'), ['child_id'])->where('parent_id IN(?)', $parentIds);
     if (!empty($excludeIds)) {
         $select->where('child_id NOT IN(?)', $excludeIds);
     }
     $children = $this->_connection->fetchCol($select);
     if ($children) {
         $select = $this->_connection->select()->from($this->_defaultIndexerResource->getTable('catalog_product_index_price'))->where('entity_id IN(?)', $children);
         $query = $select->insertFromSelect($this->_defaultIndexerResource->getIdxTable(), [], false);
         $this->_connection->query($query);
     }
     return $this;
 }
Esempio n. 2
0
 /**
  * @return string
  */
 protected function getProductIdFieldName()
 {
     $table = $this->_defaultIndexerResource->getTable('catalog_product_entity');
     $indexList = $this->_connection->getIndexList($table);
     return $indexList[$this->_connection->getPrimaryKeyName($table)]['COLUMNS_LIST'][0];
 }