Inheritance: extends Dumplie\SharedKernel\Domain\Exception\Exception
Example #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);
 }
Example #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;
 }