public function registraContacto(ContactoDTO $to)
 {
     $contacto = new Contacto($to->getId());
     $contacto->setNombre($to->getNombre());
     $contacto->setApellido($to->getApellido());
     $contacto->setTelefono($to->getTelefono());
     $contacto->setAsunto($to->getAsunto());
     $contacto->setMensaje($to->getMensaje());
     $contacto;
     try {
         $this->em->persist($contacto);
         $this->em->flush();
     } catch (ORMInvalidArgumentException $exc) {
         echo '<pre>';
         print_r($exc->getTraceAsString());
     } catch (\Doctrine\ORM\ORMException $exc) {
         echo '<pre>';
         print_r($exc->getTraceAsString());
         echo '<pre>';
         print_r($exc->getTrace());
     } catch (Exception $e) {
         echo '<pre>';
         print_r($e->getTraceAsString());
     }
     //return $contacto->getIdContact();
 }
 public function createCallContactSugar(ContactoDTO $to, $idCall)
 {
     $callContact = new CallsContacts(Utils::createIdSugar());
     $callContact->setCallId($idCall);
     $callContact->setContactId($to->getId());
     $callContact->setRequired('1');
     $callContact->setAcceptStatus('none');
     $callContact->setDateModified(Utils::getCurrentDateAndTime());
     $callContact->setDeleted(FALSE);
     try {
         $this->em->persist($callContact);
         $this->em->flush();
     } catch (Exception $exc) {
         echo $exc->getTraceAsString();
     }
 }
 private function CreateSwiftMessageForContactoForm(ContactoDTO $to)
 {
     $message = \Swift_Message::newInstance('Tiene una nueva llamada creada en sugarCRM');
     $message->setFrom($to->getEmail(), $to->getApellido() . ' ' . $to->getNombre());
     return $message;
 }