function rowToDto($row)
 {
     $objPersona = new Persona();
     $objPersona->setId($row["id"]);
     $objPersona->setNombres($row["nombres"]);
     $objPersona->setApellidos($row["apellidos"]);
     $objPersona->setEdad($row["edad"]);
     return $objPersona;
 }
Ejemplo n.º 2
0
 function consultar($id)
 {
     $consulta = "SELECT * FROM `persona` WHERE `id` = " . $id;
     $resultado = $this->conexion->consultar_servidor($consulta);
     $daop = new DAOPuestoVotacion();
     $puesto = new PuestoVotacion("", "", "", "", "");
     //        $puesto = $daop->muestraPuestoVotacion($id);
     if (empty($resultado)) {
         return FALSE;
     } else {
         $lista = mysql_fetch_array($resultado);
         $persona = new Persona($lista["cedula"], $lista["nombre"], $lista["apellido"], $lista["telefono"], $lista["celular"], $lista["direccion"], $lista["email"], $puesto);
         $persona->setId($lista["id"]);
         return $persona;
     }
 }
 /**
  * Listar algunos Responsable dado el $responsablePersonaId
  * 
  * @param $responsablePersonaId
  * @param $performSize
  * @param $firstResultNumber
  * @param $numResults
  */
 public function listResponsablesByResponsablePersonaId($responsablePersonaId, $performSize = false, $firstResultNumber = null, $numResults = null, $orderBy = null, $orderPriority = SQL_ASCENDING_ORDER)
 {
     $objBean = new PersonaBean($this->persistenceManager);
     $obj = new Persona();
     $obj->setId($responsablePersonaId);
     # Validamos los campos
     if ($firstResultNumber !== null && !EntityValidator::validatePositiveNumber($firstResultNumber)) {
         throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 95);
     }
     if (!EntityValidator::validateGlobalOrderPriority($orderPriority)) {
         throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 97);
     }
     if (!EntityValidator::validateId($responsablePersonaId)) {
         throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 99);
     }
     # Verificamos que la entidad exista
     if (!$objBean->getPersona($obj)) {
         throw new Exception(SALAS_COMP_ALERT_E_ENTITY_NOT_FOUND_FAIL, $this->ID + 101);
     }
     # Listamos las entidades
     if ($performSize) {
         $this->lastRequestSize = $this->responsableBean->countGetResponsablesByResponsablePersona($obj);
     }
     return ResponsableDTO::loadFromEntities($this->responsableBean->listResponsablesByResponsablePersona($obj, $firstResultNumber, $numResults, $orderBy, $orderPriority));
 }
Ejemplo n.º 4
0
 public static function toEntity(PersonaDTO $personaDTO)
 {
     $persona = new Persona();
     $persona->setId($personaDTO->getId());
     $persona->setPersonaDocumentoIdentidad($personaDTO->getPersonaDocumentoIdentidad());
     $persona->setPersonaNombres($personaDTO->getPersonaNombres());
     $persona->setPersonaApellidos($personaDTO->getPersonaApellidos());
     return $persona;
 }
 /**
  * Eliminar un Persona Dado el $personaId
  * 
  * @param $personaId
  */
 public function removePersona($personaId)
 {
     $responsableBean = new ResponsableBean($this->persistenceManager);
     $estudianteBean = new EstudianteBean($this->persistenceManager);
     $persona = new Persona();
     $persona->setId($personaId);
     # Validamos los campos
     if (!EntityValidator::validateId($personaId)) {
         throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 136);
     }
     # Verificamos que la entidad exista.
     if (!$this->personaBean->getPersona($persona)) {
         throw new Exception(SALAS_COMP_ALERT_E_ENTITY_NOT_FOUND_FAIL, $this->ID + 137);
     }
     # Verificamos que la entidad no esté siendo utilziada en alguna otra.
     # Verificamos que la entidad no esté siendo utilziada en Responsable->responsablePersona
     $responsables = $responsableBean->getResponsablesByResponsablePersona($persona);
     if (count($responsables) > 0) {
         throw new Exception(SALAS_COMP_ALERT_E_PERSISTENCE_REMOVE_LINKED_FAIL, $this->ID + 134);
     }
     # Verificamos que la entidad no esté siendo utilziada en Estudiante->estudiantePersona
     $estudiantes = $estudianteBean->getEstudiantesByEstudiantePersona($persona);
     if (count($estudiantes) > 0) {
         throw new Exception(SALAS_COMP_ALERT_E_PERSISTENCE_REMOVE_LINKED_FAIL, $this->ID + 135);
     }
     # Eliminamos la entidad
     if (!$this->personaBean->removePersona($persona)) {
         throw new Exception(SALAS_COMP_ALERT_E_PERSISTENCE_REMOVE_FAIL, $this->ID + 138);
     }
 }