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


class DBWorkHLIlKeypoints extends DBWorkGenerated
{
  public function __construct($pDBTyp = 1, $pNewInstance = false)
  {
    parent::__construct($pDBTyp, $pNewInstance);
    $this->select = 'id, unit_id, ilkeypoint, ilkeypointtext, ' . $this->clob('unterrichtsinhalt') . ', cef';
    $this->_dataModulFields = array('ilkeypoint', 'ilkeypointtext', 'unterrichtsinhalt', 'cef', 'unit_id', 'id');
  }

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

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

  
  public function getByUnitIdAndKeypoint($pUnitId, $pKeypoint)
  {
    $queryBuilder = $this->getSelectQueryBuilder();
    $queryBuilder->select($this->select)
            ->from($this->getTableName())
            ->where('unit_id = :unit_id: AND ilkeypoint = :keypoint:')
            ->paramInt('unit_id', $pUnitId)
            ->paramString('keypoint', $pKeypoint);

    return $this->queryGetFirstRow($queryBuilder->getSQL());
  }
}