/** * Retrieves product with id $id or throws an exception if it doesn't exist * * @param $id * * @return ProductInterface * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ protected function getProduct($id) { $product = $this->productManager->findOneBy(array('id' => $id)); if (null === $product) { throw new NotFoundHttpException(sprintf('Product (%d) not found', $id)); } return $product; }
/** * {@inheritdoc} */ public function updateStock($product, ProductManagerInterface $productManager, $diff) { $productManager->updateStock($product, $diff); }