/** * @param int $id */ public function actionDefault($id) { if ($id !== null) { $this->product = $this->productService->getById($id); } if ($this->product === null) { throw new BadRequestException(sprintf('Product with ID %d not found.', $id)); } }