public static function loadFromXML($xmlDaos) { $daos = array(); $doc = new DOMDocument('1.0', 'utf-8'); $doc->loadXML($xmlDaos); $nodes = $doc->getElementsByTagName("PrestamoBackup"); foreach ($nodes as $node) { $dao = new PrestamoBackupDTO(); $data = $node->getElementsByTagName("PrestamoBackup_Id"); if ($data->length > 0) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setId($data); $data = $node->getElementsByTagName("prestamoId"); if ($data->length > 0 && !PrestamoBackupDTO::isEmpty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setPrestamoId($data); $data = $node->getElementsByTagName("prestamoEntradaBackup"); if ($data->length > 0 && !PrestamoBackupDTO::isEmpty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setPrestamoEntradaBackup($data); $data = $node->getElementsByTagName("prestamoSalidaBackup"); if ($data->length > 0 && !PrestamoBackupDTO::isEmpty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setPrestamoSalidaBackup($data); $data = $node->getElementsByTagName("prestamoComentariosBackup"); if ($data->length > 0 && !PrestamoBackupDTO::isEmpty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setPrestamoComentariosBackup($data); $data = $node->getElementsByTagName("prestamoEstudianteBackup"); if ($data->length > 0 && !PrestamoBackupDTO::isEmpty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setPrestamoEstudianteBackup($data); $data = $node->getElementsByTagName("prestamoComputadoraBackup"); if ($data->length > 0 && !PrestamoBackupDTO::isEmpty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setPrestamoComputadoraBackup($data); $data = $node->getElementsByTagName("prestamoBackupFechaBackup"); if ($data->length > 0 && !PrestamoBackupDTO::isEmpty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setPrestamoBackupFechaBackup($data); $daos[] = $dao; } return $daos; }
public function toDTO() { $prestamoBackupDTO = new PrestamoBackupDTO(); $prestamoBackupDTO->setId($this->getId()); $prestamoBackupDTO->setPrestamoId($this->unscapeString($this->getPrestamoId())); $prestamoBackupDTO->setPrestamoEntradaBackup($this->unscapeString($this->getPrestamoEntradaBackup())); $prestamoBackupDTO->setPrestamoSalidaBackup($this->unscapeString($this->getPrestamoSalidaBackup())); $prestamoBackupDTO->setPrestamoComentariosBackup($this->unscapeString($this->getPrestamoComentariosBackup())); $prestamoBackupDTO->setPrestamoEstudianteBackup($this->unscapeString($this->getPrestamoEstudianteBackup())); $prestamoBackupDTO->setPrestamoComputadoraBackup($this->unscapeString($this->getPrestamoComputadoraBackup())); $prestamoBackupDTO->setPrestamoBackupFechaBackup($this->unscapeString($this->getPrestamoBackupFechaBackup())); return $prestamoBackupDTO; }