예제 #1
0
 /**
  * Removes Question By QuestionId
  *
  * @param string $questionId
  * @return $intMaxSortIndex
  */
 public function removeQuestionById($questionId)
 {
     $objQuestion = $this->getQuestionById($questionId);
     $intSortIndex = $objQuestion->getSortIndex();
     // Удаляем ответы для текущего вопроса
     $objAnswers = new Answers();
     $objAnswers->removeAnswersByQuestionId($questionId);
     // Удаляем данные о вопросе из БД
     $where = array('tq_id=?' => $questionId);
     $this->delete($where);
     // Обновляем порядок сортировки
     $data = array('tq_sort_index' => new Zend_Db_Expr('tq_sort_index - 1'));
     $where = $this->getAdapter()->quoteInto('tq_sort_index > ?', $intSortIndex);
     $this->update($data, $where);
 }