예제 #1
0
 /**
  * @expectedException \Magento\Framework\Exception\LocalizedException
  */
 public function testWalkException()
 {
     $this->_model->walk('test', [[$this, 'walkCallback']]);
 }
예제 #2
0
 /**
  * Get array of product ids which are matched by rule
  *
  * @return array
  */
 public function getMatchingProductIds()
 {
     if ($this->_productIds === null) {
         $this->_productIds = [];
         $this->setCollectedAttributes([]);
         if ($this->getWebsiteIds()) {
             /** @var $productCollection \Magento\Catalog\Model\ResourceModel\Product\Collection */
             $productCollection = $this->_productCollectionFactory->create();
             $productCollection->addWebsiteFilter($this->getWebsiteIds());
             if ($this->_productsFilter) {
                 $productCollection->addIdFilter($this->_productsFilter);
             }
             $this->getConditions()->collectValidatedAttributes($productCollection);
             $this->_resourceIterator->walk($productCollection->getSelect(), [[$this, 'callbackValidateProduct']], ['attributes' => $this->getCollectedAttributes(), 'product' => $this->_productFactory->create()]);
         }
     }
     return $this->_productIds;
 }