protected function getAddress($id) { $address = $this->addressManager->findOneBy(array('id' => $id)); if (null === $address) { throw new NotFoundHttpException(sprintf('Address (%d) not found', $id)); } return $address; }