/** * @param Alert $alert * * @return AlertDTO */ public function updateAlert(Alert $alert) { $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); }
/** * @param User $user * * @return UserDTO */ public function updateUser(User $user) { $infos = Geocoder::getLocation($user->getPositionLat(), $user->getPositionLong()); $city = Geocoder::getCityFromAddress($infos); $department = Geocoder::getDepartmentFromAddress($infos); $country = Geocoder::getCountryFromAddress($infos); $user->setPositionCity($city); $user->setPositionDep($department); $user->setPositionCountry($country); $this->em->persist($user); $this->em->flush(); return new UserDTO($user); }