- $em = $this->getDoctrine()->getManager();
- $person = $em->getRepository('App:Person')->find($request->get('email'));
+ $em = $this->getDoctrine()->getManager();
+ $person = $em->getRepository('App:Person')->find($request->get('email'));
+
+ if (empty($person)) {
+ return new JsonResponse(['message' => 'Person not found'], Response::HTTP_NOT_FOUND);
+ }