public function updateActivity($id) { $row = $this->retrieveOldActivity($id); if (!$row) { return; } $activity = $this->em->getRepository('AppBundle:Actividad')->findOneBy(array('oldId' => $row['id'])); if (!$activity) { $activity = new Actividad(); } $activity->setCosto($row['costo']); $activity->setHorario($row['horario']); $activity->setNombre(trim($row['nombre'])); $activity->setOldId($id); $this->em->persist($activity); $activity->setNewsLetterGroup($this->newsLetterSyncService->updateOrCreateActivityGroup(trim($row['nombre']))); $this->em->persist($activity); $this->em->flush(); foreach ($activity->getEstudiantes() as $estudiante) { $this->facturasServices->generateUserAndFinalBill($estudiante); } return true; }