示例#1
0
文件: Writer.php 项目: spryker/Stock
 /**
  * @param \Generated\Shared\Transfer\TypeTransfer $stockTypeTransfer
  *
  * @throws \Spryker\Zed\Stock\Business\Exception\StockTypeNotFoundException
  *
  * @return int
  */
 public function updateStockType(TypeTransfer $stockTypeTransfer)
 {
     Propel::getConnection()->beginTransaction();
     $stockTypeEntity = $this->queryContainer->queryStockByName($stockTypeTransfer->getName())->findOne();
     if ($stockTypeEntity === null) {
         throw new StockTypeNotFoundException();
     }
     $stockTypeEntity->setName($stockTypeTransfer->getName());
     $stockTypeEntity->save();
     Propel::getConnection()->commit();
     return $stockTypeEntity->getIdStock();
 }
示例#2
0
文件: Reader.php 项目: spryker/Stock
 /**
  * @param string $stockType
  *
  * @return bool
  */
 protected function hasStockType($stockType)
 {
     $stockTypeCount = $this->queryContainer->queryStockByName($stockType)->count();
     return $stockTypeCount > 0;
 }