/** * 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 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; }