public function testReset() { $this->collection->reset(); }
/** * Load exiting custom options data * * @return $this */ protected function _initOldCustomOptions() { if (!$this->_oldCustomOptions) { $oldCustomOptions = []; $optionTitleTable = $this->_tables['catalog_product_option_title']; foreach ($this->_storeCodeToId as $storeId) { $addCustomOptions = function (\Magento\Catalog\Model\Product\Option $customOption) use(&$oldCustomOptions, $storeId) { $productId = $customOption->getProductId(); if (!isset($oldCustomOptions[$productId])) { $oldCustomOptions[$productId] = []; } if (isset($oldCustomOptions[$productId][$customOption->getId()])) { $oldCustomOptions[$productId][$customOption->getId()]['titles'][$storeId] = $customOption->getTitle(); } else { $oldCustomOptions[$productId][$customOption->getId()] = ['titles' => [$storeId => $customOption->getTitle()], 'type' => $customOption->getType()]; } }; /** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Option\Collection */ $this->_optionCollection->reset(); $this->_optionCollection->getSelect()->join(['option_title' => $optionTitleTable], 'option_title.option_id = main_table.option_id', ['title' => 'title', 'store_id' => 'store_id'])->where('option_title.store_id = ?', $storeId); $this->_byPagesIterator->iterate($this->_optionCollection, $this->_pageSize, [$addCustomOptions]); } $this->_oldCustomOptions = $oldCustomOptions; } return $this; }