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


class DBWorkRaumausstattung extends DBWorkGenerated
{
  public function __construct($pDBTyp = 1, $pNewInstance = false)
  {
    parent::__construct($pDBTyp, $pNewInstance);
    $this->select = 'id, ortnr, res_name, bemerkung';
  }

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

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

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

    $tmp->id = $this->getDatamodulValue('id');
    $tmp->res_name = $this->getDatamodulValue('res_name');
    $tmp->bemerkung = $this->getDatamodulValue('bemerkung');
    $tmp->ortnr = $this->getDatamodulValue('ortnr');

    return $tmp;
  }

  public function getAusstattungByOrt($pOrtNr)
  {
    $ortnr = $this->dboperation->getInt4Sql($pOrtNr);
    $sql = 'SELECT ' . $this->select . ' FROM ' . $this->getTableName()
      . " WHERE ortnr=$ortnr";
    $this->dboperation->clear();
    $this->dboperation->query($sql);

    return $this->getAllRows();
  }
}