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();
 }
 /**
  * 
  * @param \calavera\customerBundle\DTO\ContactoDTO $to
  * @return boolean
  */
 public function creaContacto(ContactoDTO $to)
 {
     $success = FALSE;
     $contacto = new \calavera\customerBundle\Entity\Contacts($to->getId());
     $contacto->setFirstName($to->getNombre());
     $contacto->setLastName($to->getApellido());
     $contacto->setTitle($to->getAsunto());
     $contacto->setPhoneWork($to->getTelefono());
     $contacto->setDescription($to->getMensaje());
     $contacto->setDateModified(Utils::getCurrentDateAndTime());
     $contacto->setDateEntered(Utils::getCurrentDateAndTime());
     $contacto->setDeleted(FALSE);
     $contacto->setCreatedBy('1');
     $contacto->setModifiedUserId('1');
     try {
         $this->em->persist($contacto);
         $this->em->flush();
         $success = true;
     } catch (Exception $exc) {
         echo $exc->getTraceAsString();
     }
     return $success;
 }
 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;
 }