Ejemplo n.º 1
0
 private function sendPasswordEmailWithErrorHandling(User $user, $sendPassword, $successfullResponseCreator)
 {
     try {
         $sendPassword();
         $response = $successfullResponseCreator();
     } catch (Exception $e) {
         $translator = $this->get('translator');
         $response = new Response('{' . '"userId":"' . $user->getId() . '",' . '"error": "' . $translator->trans('user.emailSent') . '"' . '}', Response::HTTP_ACCEPTED);
     }
     return $response;
 }