Пример #1
0
 public function toDTO()
 {
     $softwareDTO = new SoftwareDTO();
     $softwareDTO->setId($this->getId());
     $softwareDTO->setSoftwareNumeroSerie($this->unscapeString($this->getSoftwareNumeroSerie()));
     $softwareDTO->setSoftwareNombre($this->unscapeString($this->getSoftwareNombre()));
     $softwareDTO->setSoftwareVersion($this->unscapeString($this->getSoftwareVersion()));
     $softwareDTO->setSoftwareFechaCaducidad($this->unscapeString($this->getSoftwareFechaCaducidad()));
     $softwareDTO->setSoftwareFechaAquisicion($this->unscapeString($this->getSoftwareFechaAquisicion()));
     $softwareDTO->setSoftwareEquiposPermitidos($this->unscapeString($this->getSoftwareEquiposPermitidos()));
     $softwareDTO->setSoftwareComentarios($this->unscapeString($this->getSoftwareComentarios()));
     return $softwareDTO;
 }
Пример #2
0
 public static function loadFromXML($xmlDaos)
 {
     $daos = array();
     $doc = new DOMDocument('1.0', 'utf-8');
     $doc->loadXML($xmlDaos);
     $nodes = $doc->getElementsByTagName("Software");
     foreach ($nodes as $node) {
         $dao = new SoftwareDTO();
         $data = $node->getElementsByTagName("Software_Id");
         if ($data->length > 0) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setId($data);
         $data = $node->getElementsByTagName("softwareNumeroSerie");
         if ($data->length > 0 && !SoftwareDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setSoftwareNumeroSerie($data);
         $data = $node->getElementsByTagName("softwareNombre");
         if ($data->length > 0 && !SoftwareDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setSoftwareNombre($data);
         $data = $node->getElementsByTagName("softwareVersion");
         if ($data->length > 0 && !SoftwareDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setSoftwareVersion($data);
         $data = $node->getElementsByTagName("softwareFechaCaducidad");
         if ($data->length > 0 && !SoftwareDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setSoftwareFechaCaducidad($data);
         $data = $node->getElementsByTagName("softwareFechaAquisicion");
         if ($data->length > 0 && !SoftwareDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setSoftwareFechaAquisicion($data);
         $data = $node->getElementsByTagName("softwareEquiposPermitidos");
         if ($data->length > 0 && !SoftwareDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setSoftwareEquiposPermitidos($data);
         $data = $node->getElementsByTagName("softwareComentarios");
         if ($data->length > 0 && !SoftwareDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setSoftwareComentarios($data);
         $daos[] = $dao;
     }
     return $daos;
 }