示例#1
0
 function getList($pagina = 1, $orden = "", $nrpp = Configuracion::NRPP, $condicion = "1=1", $parametros = array())
 {
     $ordenPredeterminado = "{$orden}, idprestamo";
     if (trim($orden) === "" || trim($orden) === NULL) {
         $ordenPredeterminado = "idprestamo";
     }
     $registroInicial = ($pagina - 1) * $nrpp;
     $this->bd->select($this->tabla, "*", $condicion, $parametros, $ordenPredeterminado, "{$registroInicial}, {$nrpp}");
     $r = array();
     while ($fila = $this->bd->getRow()) {
         $prestamo = new Prestamo();
         $prestamo->set($fila);
         $r[] = $prestamo;
     }
     return $r;
     //Devuelve un array de ciudades;
 }
示例#2
0
 function getListJuegosPrestamo($condicion = NULL, $parametros = array())
 {
     if ($condicion === NULL) {
         $condicion = "";
     } else {
         $condicion = "where {$condicion}";
     }
     $sql = "select prestamo.*, ludoteca.*, usuario.* from prestamo " . "left join ludoteca on prestamo.idjuego = ludoteca.id " . "left join usuario on prestamo.dni = usuario.dni";
     $this->bd->send($sql, $parametros);
     $r = array();
     $contador = 0;
     while ($fila = $this->bd->getRow()) {
         $prestamo = new Prestamo();
         $prestamo->set($fila);
         $ludoteca = new Ludoteca();
         $ludoteca->set($fila, 5);
         $usuario = new Usuario();
         $usuario->set($fila, 12);
         $r[] = new PrestamoJuegoUSuario($prestamo, $ludoteca, $usuario);
     }
     return $r;
 }
 /**
  * Eliminar un Prestamo Dado el $prestamoId
  * 
  * @param $prestamoId
  */
 public function removePrestamo($prestamoId)
 {
     $prestamo = new Prestamo();
     $prestamo->setId($prestamoId);
     # Validamos los campos
     if (!EntityValidator::validateId($prestamoId)) {
         throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 118);
     }
     # Verificamos que la entidad exista.
     if (!$this->prestamoBean->getPrestamo($prestamo)) {
         throw new Exception(SALAS_COMP_ALERT_E_ENTITY_NOT_FOUND_FAIL, $this->ID + 119);
     }
     # Verificamos que la entidad no esté siendo utilziada en alguna otra.
     # Eliminamos la entidad
     if (!$this->prestamoBean->removePrestamo($prestamo)) {
         throw new Exception(SALAS_COMP_ALERT_E_PERSISTENCE_REMOVE_FAIL, $this->ID + 120);
     }
 }
 public function updatePrestamoComputadora(Prestamo $entity, Computadora $prestamoComputadora)
 {
     $entity->setPrestamoComputadora($prestamoComputadora->getId());
     return $this->persistenceManager->update($entity);
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Prestamo the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Prestamo::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public static function toEntity(PrestamoDTO $prestamoDTO)
 {
     $prestamo = new Prestamo();
     $prestamo->setId($prestamoDTO->getId());
     $prestamo->setPrestamoEntrada($prestamoDTO->getPrestamoEntrada());
     $prestamo->setPrestamoSalida($prestamoDTO->getPrestamoSalida());
     $prestamo->setPrestamoComentarios($prestamoDTO->getPrestamoComentarios());
     $prestamo->setPrestamoEstudiante($prestamoDTO->getPrestamoEstudiante());
     $prestamo->setPrestamoComputadora($prestamoDTO->getPrestamoComputadora());
     return $prestamo;
 }