Пример #1
0
 /**
  * @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
 /**
  * @param string $stockType
  *
  * @return bool
  */
 protected function hasStockType($stockType)
 {
     $stockTypeCount = $this->queryContainer->queryStockByName($stockType)->count();
     return $stockTypeCount > 0;
 }