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


class DBWorkHLAnmArt extends DBWorkHLBasis
{
  
  public function getNewObject()
  {
    return new AnmArt();
  }

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

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

    return $tmp;
  }

  
  public function getAll()
  {
    $this->dboperation->clear();
    $sql = 'SELECT id, kennz, text FROM anm_art';
    if ($this->orderby != '') {
      $sql .= $this->getCompleteOrderByDefault($this->orderby);
    }
    $this->dboperation->query($sql);

    return $this->getAllRows();
  }

  
  public function getOne($pId)
  {
    $id = $this->dboperation->getInt4Sql($pId);
    $this->dboperation->clear();
    $this->dboperation->query("SELECT id, kennz, text FROM anm_art WHERE id='" . $id . "'");

    return $this->getFirstRow();
  }

  
  public function getAnmArtByKennz($pKennz)
  {
    $kennz = $this->dboperation->getString4Sql($pKennz);
    $this->dboperation->clear();
    $this->dboperation->query("SELECT id, kennz, text FROM anm_art where kennz='" . $kennz . "'");

    return $this->getFirstRow();
  }
}