示例#1
0
文件: Writer.php 项目: spryker/Stock
 /**
  * @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
文件: Reader.php 项目: spryker/Stock
 /**
  * @param string $stockType
  *
  * @return bool
  */
 protected function hasStockType($stockType)
 {
     $stockTypeCount = $this->queryContainer->queryStockByName($stockType)->count();
     return $stockTypeCount > 0;
 }