コード例 #1
0
 public static function loadFromXML($xmlDaos)
 {
     $daos = array();
     $doc = new DOMDocument('1.0', 'utf-8');
     $doc->loadXML($xmlDaos);
     $nodes = $doc->getElementsByTagName("Responsable");
     foreach ($nodes as $node) {
         $dao = new ResponsableDTO();
         $data = $node->getElementsByTagName("Responsable_Id");
         if ($data->length > 0) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setId($data);
         $data = $node->getElementsByTagName("responsableFacultad");
         if ($data->length > 0 && !ResponsableDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setResponsableFacultad($data);
         $data = $node->getElementsByTagName("responsableAsignatura");
         if ($data->length > 0 && !ResponsableDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setResponsableAsignatura($data);
         $data = $node->getElementsByTagName("responsablePersona");
         if ($data->length > 0 && !empty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setResponsablePersona($data);
         $daos[] = $dao;
     }
     return $daos;
 }
コード例 #2
0
 public function toDTO()
 {
     $responsableDTO = new ResponsableDTO();
     $responsableDTO->setId($this->getId());
     $responsableDTO->setResponsableFacultad($this->unscapeString($this->getResponsableFacultad()));
     $responsableDTO->setResponsableAsignatura($this->unscapeString($this->getResponsableAsignatura()));
     $responsableDTO->setResponsablePersona($this->unscapeString($this->getResponsablePersona()));
     return $responsableDTO;
 }