상속: extends Dumplie\SharedKernel\Domain\Exception\Exception
예제 #1
0
 /**
  * @param SKU $SKU
  *
  * @return Product
  *
  * @throws ProductNotFound - when product with given SKU were not found
  */
 public function getBySku(SKU $SKU) : Product
 {
     if (isset($this->products[(string) $SKU])) {
         return $this->products[(string) $SKU];
     }
     throw ProductNotFound::bySku($SKU);
 }
예제 #2
0
 /**
  * @param SKU $SKU
  * @return Product
  */
 public function getBySku(SKU $SKU) : Product
 {
     $product = $this->entityManager->getRepository(Product::class)->findOneBy(['sku.code' => $SKU]);
     if ($product === null) {
         ProductNotFound::bySku($SKU);
     }
     return $product;
 }