Пример #1
0
 /**
  * @param string $sku
  * @param string $stockType
  * @param int $incrementBy
  *
  * @return void
  */
 public function incrementStock($sku, $stockType, $incrementBy = 1)
 {
     Propel::getConnection()->beginTransaction();
     $idProduct = $this->reader->getProductConcreteIdBySku($sku);
     $idStock = $this->reader->getStockTypeIdByName($stockType);
     $stockProductEntity = $this->queryContainer->queryStockProductByStockAndProduct($idStock, $idProduct)->findOneOrCreate();
     $stockProductEntity->increment($incrementBy);
     $this->insertActiveTouchRecordStockProduct($stockProductEntity);
     Propel::getConnection()->commit();
 }
Пример #2
0
 /**
  * @param string $stockType
  *
  * @return bool
  */
 protected function hasStockType($stockType)
 {
     $stockTypeCount = $this->queryContainer->queryStockByName($stockType)->count();
     return $stockTypeCount > 0;
 }