protected function getInvoice($id) { $invoice = $this->invoiceManager->findOneBy(array('id' => $id)); if (null === $invoice) { throw new NotFoundHttpException(sprintf('Invoice (%d) not found', $id)); } return $invoice; }