Пример #1
0
 /**
  * Delete unnecessary links.
  *
  * @return $this
  */
 protected function _deleteData()
 {
     $linkTable = $this->_resource->getTableName('catalog_product_super_link');
     $relationTable = $this->_resource->getTableName('catalog_product_relation');
     if ($this->_entityModel->getBehavior() == \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND && !empty($this->_productSuperData['product_id']) && !empty($this->_simpleIdsToDelete)) {
         $quoted = $this->_connection->quoteInto('IN (?)', [$this->_productSuperData['product_id']]);
         $quotedChildren = $this->_connection->quoteInto('IN (?)', $this->_simpleIdsToDelete);
         $this->_connection->delete($linkTable, "parent_id {$quoted} AND product_id {$quotedChildren}");
         $this->_connection->delete($relationTable, "parent_id {$quoted} AND child_id {$quotedChildren}");
     }
     return $this;
 }