<?php
/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */


class DBWorkNation extends DBWork
{
  public function __construct($pDBTyp = 1, $pNewInstance = false)
  {
    parent::__construct($pDBTyp, $pNewInstance);
    $this->select = 'id, text ';
    $this->orderby = 'text';
  }

  
  public function getNewObject()
  {
    return new Nation();
  }

  public function getTableName(): string
  {
    return 'nationen';
  }

  
  public function getCurrentRow($pRefreshCache = false)
  {
    $tmp = $this->getNewObject();
    $tmp->id = $this->getDatamodulValue('id');
    $tmp->text = $this->getDatamodulValue('text');

    return $tmp;
  }

  
  public function getNationen()
  {
    $this->dboperation->clear();
    $this->dboperation->query('SELECT ' . $this->select . ' FROM nationen '
        . ' ORDER BY ' . $this->orderby);

    return $this->getAllRows();
  }
}