Пример #1
0
 /**
  * @param Basket $basket
  * @param Product $product
  * @return BasketItem
  * @throws BasketItemNotFound
  */
 public function findBasketItem(Basket $basket, Product $product)
 {
     $data = ['basket' => $basket->getId(), 'product' => $product->getId()];
     $item = $this->_getItem($data);
     if (empty($item)) {
         throw new BasketItemNotFound($this->_newInstance($data));
     }
     return $item;
 }
Пример #2
0
 /**
  * @param array $data
  * @return string
  */
 protected function _getId(array $data)
 {
     return Basket::calculateId($data);
 }
Пример #3
0
 public function __construct(Basket $basket, Exception $previous = null)
 {
     parent::__construct('Basket #' . $basket->getId() . ' not found', 404, $previous);
 }