Exemplo n.º 1
0
 /**
  * @param Alert $alert
  *
  * @return AlertDTO
  */
 public function createAlert(Alert $alert)
 {
     $alert->setCreatedAt(new \Datetime());
     $infos = Geocoder::getLocation($alert->getPositionLat(), $alert->getPositionLong());
     $city = Geocoder::getCityFromAddress($infos);
     $department = Geocoder::getDepartmentFromAddress($infos);
     $country = Geocoder::getCountryFromAddress($infos);
     $alert->setPositionCity($city);
     $alert->setPositionDep($department);
     $alert->setPositionCountry($country);
     $this->em->persist($alert);
     $this->em->flush();
     return new AlertDTO($alert);
 }