public static function loadFromXML($xmlDaos) { $daos = array(); $doc = new DOMDocument('1.0', 'utf-8'); $doc->loadXML($xmlDaos); $nodes = $doc->getElementsByTagName("ComputadoraSoftware"); foreach ($nodes as $node) { $dao = new ComputadoraSoftwareDTO(); $data = $node->getElementsByTagName("ComputadoraSoftware_Id"); if ($data->length > 0) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setId($data); $data = $node->getElementsByTagName("numeroSeriePrograma"); if ($data->length > 0 && !ComputadoraSoftwareDTO::isEmpty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setNumeroSeriePrograma($data); $data = $node->getElementsByTagName("compSoftFechaInstalacion"); if ($data->length > 0 && !ComputadoraSoftwareDTO::isEmpty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setCompSoftFechaInstalacion($data); $data = $node->getElementsByTagName("computadora"); if ($data->length > 0 && !empty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setComputadora($data); $data = $node->getElementsByTagName("software"); if ($data->length > 0 && !empty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setSoftware($data); $daos[] = $dao; } return $daos; }
public function toDTO() { $computadoraSoftwareDTO = new ComputadoraSoftwareDTO(); $computadoraSoftwareDTO->setId($this->getId()); $computadoraSoftwareDTO->setNumeroSeriePrograma($this->unscapeString($this->getNumeroSeriePrograma())); $computadoraSoftwareDTO->setCompSoftFechaInstalacion($this->unscapeString($this->getCompSoftFechaInstalacion())); $computadoraSoftwareDTO->setComputadora($this->unscapeString($this->getComputadora())); $computadoraSoftwareDTO->setSoftware($this->unscapeString($this->getSoftware())); return $computadoraSoftwareDTO; }