<?php
/**
 * @copyright (c) Kufer Software GmbH, Oderstraße 7, D-84453 Mühldorf
 */


class DBWorkFeedBackRetourDetails extends DBWorkGenerated
{
  public function __construct($pDBTyp = 1, $pNewInstance = false)
  {
    parent::__construct($pDBTyp, $pNewInstance);

    
    
    $this->select = 'id, retourid, frageid, wert, ' . $this->clob('antwort') . ', bearbeiter, bearbdatum, '
            . 'erfasstvon, erfasstam, bogenfragenid';

    
    $this->_dataModulFields = array('id', 'retourid', 'frageid', 'wert', 'antwort', 'bearbeiter',
        'bearbdatum', 'erfasstvon', 'erfasstam', 'bogenfragenid');
  }

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

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

  
  public function getAllDataByFeedbackRetourID($pFeedbackRetourID)
  {
    if (empty($pFeedbackRetourID)) {
      return array();
    }
    
    $feedbackretourID = $this->dboperation->getInts4Sql($pFeedbackRetourID);
    
    $sqlstr = 'SELECT ' . $this->select . ' FROM ' . $this->getTableName() . ' WHERE '
            . $this->createInStatement('retourid', $feedbackretourID);

    
    $this->dboperation->clear();
    
    $this->dboperation->query($sqlstr);

    return $this->getAllRows();
  }

  
  public function insertFeedBackDetailsRetour($pFeedBackRetourDetails)
  {
    $pFeedBackRetourDetails->id = $this->insertRecord($this->getTableName(), 'id', 'erfasstvon', true);

    $originalEintrag = new FeedBackRetourDetails();
    $originalEintrag->id = $pFeedBackRetourDetails->id;

    $this->updateObject($pFeedBackRetourDetails, $originalEintrag, $this->getTableName(), 'id', 'U', true);

    return $pFeedBackRetourDetails;
  }
}