예제 #1
0
 public function toDTO()
 {
     $prestamoDTO = new PrestamoDTO();
     $prestamoDTO->setId($this->getId());
     $prestamoDTO->setPrestamoEntrada($this->unscapeString($this->getPrestamoEntrada()));
     $prestamoDTO->setPrestamoSalida($this->unscapeString($this->getPrestamoSalida()));
     $prestamoDTO->setPrestamoComentarios($this->unscapeString($this->getPrestamoComentarios()));
     $prestamoDTO->setPrestamoEstudiante($this->unscapeString($this->getPrestamoEstudiante()));
     $prestamoDTO->setPrestamoComputadora($this->unscapeString($this->getPrestamoComputadora()));
     return $prestamoDTO;
 }
예제 #2
0
 public static function loadFromXML($xmlDaos)
 {
     $daos = array();
     $doc = new DOMDocument('1.0', 'utf-8');
     $doc->loadXML($xmlDaos);
     $nodes = $doc->getElementsByTagName("Prestamo");
     foreach ($nodes as $node) {
         $dao = new PrestamoDTO();
         $data = $node->getElementsByTagName("Prestamo_Id");
         if ($data->length > 0) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setId($data);
         $data = $node->getElementsByTagName("prestamoEntrada");
         if ($data->length > 0 && !PrestamoDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setPrestamoEntrada($data);
         $data = $node->getElementsByTagName("prestamoSalida");
         if ($data->length > 0 && !PrestamoDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setPrestamoSalida($data);
         $data = $node->getElementsByTagName("prestamoComentarios");
         if ($data->length > 0 && !PrestamoDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setPrestamoComentarios($data);
         $data = $node->getElementsByTagName("prestamoEstudiante");
         if ($data->length > 0 && !empty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setPrestamoEstudiante($data);
         $data = $node->getElementsByTagName("prestamoComputadora");
         if ($data->length > 0 && !empty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setPrestamoComputadora($data);
         $daos[] = $dao;
     }
     return $daos;
 }