14 private $resetVotingResult =
true;
18 $this->resetVotingResult = $bool;
24 private $answerCopier =
null;
32 $this->answerCopier = $answerCopier;
45 $result = QuestionTable::add($fields);
52 $this->result->addErrors(
$result->getErrors());
69 $queryObject = QuestionTable::getById($entityId);
70 return (($fields = $queryObject->fetch()) ? $fields : []);
84 $fields[
"FIELD_TYPE"] = (int) $fields[
"FIELD_TYPE"];
91 if ($this->resetVotingResult)
93 unset($fields[
"COUNTER"]);
111 $results[] = $this->copyAnswer($entityId, $copiedEntityId);
116 private function copyAnswer(
int $questionId,
int $copiedQuestionId)
118 if (!$this->answerCopier)
124 $queryObject = AnswerTable::getList([
"order" => [],
"filter" => [
"QUESTION_ID" => $questionId]]);
125 while ($question = $queryObject->fetch())
127 $container =
new Container($question[
"ID"]);
128 $container->setParentId($copiedQuestionId);
129 $containerCollection[] = $container;
132 if (!$containerCollection->isEmpty())
134 return $this->answerCopier->copy($containerCollection);
getResult(array $results=[])