protected function getOrder($id) { $order = $this->orderManager->findOneBy(array('id' => $id)); if (null === $order) { throw new NotFoundHttpException(sprintf('Order (%d) not found', $id)); } return $order; }