private function generarEmailSolImpNotificacion(SolImportacionDet $solImportacionDet, Transicion $transicion) { $transicionDao = new TransicionDao($this->getDoctrine()); $entidadDao = new EntidadDao($this->getDoctrine()); $impDetId = $solImportacionDet->getImpDetId(); $etpNombre = $transicion->getEtpFin()->getEtpNombre(); $entNombComercial = $solImportacionDet->getSolImportacion()->getEntidad()->getEntNombComercial(); $traId = $transicion->getTraId(); $entId = $solImportacionDet->getSolImportacion()->getEntidad()->getEntId(); $url = urlencode($this->generateUrl('MinSalSCAProcesosBundle_mantCargarSolImportacion', array('impDetId' => $impDetId), true)); $url = $this->generateUrl('MinSalSCABundle_homepage', array(), true) . '?url=' . $url; $subject = 'Cancelación automática de Solicitud #' . $impDetId; $emails = $transicionDao->getEmailsXTransicion($entId, $traId); if ($transicion->getTraNotificaEmpresa()) { $emailsXEmpresa = $entidadDao->getEmailsXEmpresa($entId); foreach ($emailsXEmpresa as $reg) { if (!in_array($reg, $emails)) { $emails[] = $reg; } } } foreach ($emails as $email) { $message = \Swift_Message::newInstance($subject)->setFrom(array($this->container->getParameter('contact_email') => 'SCA'))->setTo($email)->setBody($this->renderView('MinSalSCAProcesosBundle:SolImportacionDet\\Email:SolicitudExpirada.html.twig', array('solImpId' => $impDetId, 'entNombComercial' => $entNombComercial, 'etpNombre' => $etpNombre, 'url' => $url)), 'text/html')->addPart($this->renderView('MinSalSCAProcesosBundle:SolImportacionDet\\Email:SolicitudExpirada.txt.twig', array('solImpId' => $impDetId, 'entNombComercial' => $entNombComercial, 'etpNombre' => $etpNombre, 'url' => $url)), 'text/plain'); $this->get('mailer')->send($message); } }