public function recoverAction(Person $user)
 {
     $reset = new PasswordRecover($user);
     $em = $this->getDoctrine()->getManager();
     $em->persist($reset);
     $em->flush();
     $message = \Swift_Message::newInstance()->setSubject('roeselarevrijwilligt.be wachtwoord reset')->setFrom('*****@*****.**')->setTo($user->getEmail())->setBody($this->renderView('email/reset_email.html.twig', array('recover' => $reset)), 'text/html');
     $this->get('mailer')->send($message);
 }
 /**
  * @Route("/{id}", name="update_person")
  * @Method("PUT")
  * @ParamConverter("person", converter="fos_rest.request_body")
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 public function updatePerson($id, Person $person)
 {
     $em = $this->getDoctrine()->getManager();
     $dbPerson = new Person();
     $dbPerson = $this->getDoctrine()->getRepository('AppBundle:Person')->find($id);
     $dbPerson->setName($person->getName());
     $dbPerson->setAge($person->getAge());
     $dbPerson->setEmail($person->getEmail());
     $dbPerson->setLastName($person->getLastname());
     $dbPerson->setTelephone($person->getTelephone());
     $errors = $this->getErrors($person);
     if (isset($errors)) {
         return $this->view($errors, 400);
     }
     $em->persist($dbPerson);
     $em->flush();
     return $dbPerson;
 }
 /**
  * Turn this item object into a generic array
  *
  * @return array
  */
 public function transform(Person $person)
 {
     return ['id' => (int) $person->getId(), 'firstname' => $person->getFirstname(), 'lastname' => $person->getLastname(), 'email' => $person->getEmail(), 'organizationId' => $person->getOrganization()->getId(), 'fileCount' => $person->getNumFiles(), 'createdAt' => $person->getCreatedAt(), 'updatedAt' => $person->getUpdatedAt()];
 }