public static function loadFromXML($xmlDaos) { $daos = array(); $doc = new DOMDocument('1.0', 'utf-8'); $doc->loadXML($xmlDaos); $nodes = $doc->getElementsByTagName("Impresion"); foreach ($nodes as $node) { $dao = new ImpresionDTO(); $data = $node->getElementsByTagName("Impresion_Id"); if ($data->length > 0) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setId($data); $data = $node->getElementsByTagName("impresionFecha"); if ($data->length > 0 && !ImpresionDTO::isEmpty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setImpresionFecha($data); $data = $node->getElementsByTagName("impresionLugar"); if ($data->length > 0 && !ImpresionDTO::isEmpty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setImpresionLugar($data); $data = $node->getElementsByTagName("impresionEstudiante"); if ($data->length > 0 && !empty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setImpresionEstudiante($data); $daos[] = $dao; } return $daos; }
/** * Listar algunos Impresion dado el $impresionEstudianteId * * @param $impresionEstudianteId * @param $performSize * @param $firstResultNumber * @param $numResults */ public function listImpresionsByImpresionEstudianteId($impresionEstudianteId, $performSize = false, $firstResultNumber = null, $numResults = null, $orderBy = null, $orderPriority = SQL_ASCENDING_ORDER) { $objBean = new EstudianteBean($this->persistenceManager); $obj = new Estudiante(); $obj->setId($impresionEstudianteId); # Validamos los campos if ($firstResultNumber !== null && !EntityValidator::validatePositiveNumber($firstResultNumber)) { throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 77); } if (!EntityValidator::validateGlobalOrderPriority($orderPriority)) { throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 79); } if (!EntityValidator::validateId($impresionEstudianteId)) { throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 81); } # Verificamos que la entidad exista if (!$objBean->getEstudiante($obj)) { throw new Exception(SALAS_COMP_ALERT_E_ENTITY_NOT_FOUND_FAIL, $this->ID + 83); } # Listamos las entidades if ($performSize) { $this->lastRequestSize = $this->impresionBean->countGetImpresionsByImpresionEstudiante($obj); } return ImpresionDTO::loadFromEntities($this->impresionBean->listImpresionsByImpresionEstudiante($obj, $firstResultNumber, $numResults, $orderBy, $orderPriority)); }
public function toDTO() { $impresionDTO = new ImpresionDTO(); $impresionDTO->setId($this->getId()); $impresionDTO->setImpresionFecha($this->unscapeString($this->getImpresionFecha())); $impresionDTO->setImpresionLugar($this->unscapeString($this->getImpresionLugar())); $impresionDTO->setImpresionEstudiante($this->unscapeString($this->getImpresionEstudiante())); return $impresionDTO; }