protected function getCustomer($id) { $customer = $this->customerManager->findOneBy(array('id' => $id)); if (null === $customer) { throw new NotFoundHttpException(sprintf('Customer (%d) not found', $id)); } return $customer; }