/** * @param assFormulaQuestionUnitCategory $category * @throws ilException */ public function saveNewUnitCategory(assFormulaQuestionUnitCategory $category) { /** * @var $ilDB ilDB */ global $ilDB; $res = $ilDB->queryF('SELECT category FROM il_qpl_qst_fq_ucat WHERE category = %s AND question_fi = %s', array('text', 'integer'), array($category->getCategory(), $this->getConsumerId())); if ($ilDB->numRows($res)) { throw new ilException('err_wrong_categoryname'); } $next_id = $ilDB->nextId('il_qpl_qst_fq_ucat'); $ilDB->manipulateF("INSERT INTO il_qpl_qst_fq_ucat (category_id, category, question_fi) VALUES (%s, %s, %s)", array('integer', 'text', 'integer'), array($next_id, $category->getCategory(), (int) $this->getConsumerId())); $category->setId($next_id); }