/**
  * Retrieve connection for write data
  *
  * @return \Magento\Framework\DB\Adapter\AdapterInterface|false
  */
 protected function _getIndexAdapter()
 {
     if (!$this->_newIndexAdapter) {
         return parent::_getIndexAdapter();
     } else {
         return $this->_getConnection('new_write');
     }
 }
 /**
  * Class constructor
  *
  * @param \Magento\Framework\Model\Resource\Db\Context $context
  * @param \Magento\Eav\Model\Config $eavConfig
  * @param string|null $resourcePrefix
  */
 public function __construct(\Magento\Framework\Model\Resource\Db\Context $context, \Magento\Eav\Model\Config $eavConfig, $resourcePrefix = null)
 {
     $this->_eavConfig = $eavConfig;
     parent::__construct($context, $resourcePrefix);
 }
Esempio n. 3
0
 /**
  * Return name of table for given $storeId.
  *
  * @param integer $storeId
  * @return string
  */
 public function getMainStoreTable($storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID)
 {
     if (is_string($storeId)) {
         $storeId = intval($storeId);
     }
     if ($storeId) {
         $suffix = sprintf('store_%d', $storeId);
         $table = $this->getTable('catalog_category_flat_' . $suffix);
     } else {
         $table = parent::getMainTable();
     }
     return $table;
 }
Esempio n. 4
0
 /**
  * Class constructor
  *
  * @param \Magento\Framework\Model\Resource\Db\Context $context
  * @param \Magento\Indexer\Model\Indexer\Table\StrategyInterface $tableStrategy
  * @param \Magento\Eav\Model\Config $eavConfig
  * @param string|null $resourcePrefix
  */
 public function __construct(\Magento\Framework\Model\Resource\Db\Context $context, \Magento\Indexer\Model\Indexer\Table\StrategyInterface $tableStrategy, \Magento\Eav\Model\Config $eavConfig, $resourcePrefix = null)
 {
     $this->_eavConfig = $eavConfig;
     parent::__construct($context, $tableStrategy, $resourcePrefix);
 }