/**
  * @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;
 }
 /**
  * {@inheritDoc}
  */
 public function getAge()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getAge', array());
     return parent::getAge();
 }