2namespace Bitrix\Vote\Copy\Implement;
4use Bitrix\Main\Copy\Container;
5use Bitrix\Main\Copy\ContainerCollection;
6use Bitrix\Main\Copy\CopyImplementer;
7use Bitrix\Main\Copy\EntityCopier;
9use Bitrix\Vote\AnswerTable;
10use Bitrix\Vote\QuestionTable;
14 private $resetVotingResult =
true;
18 $this->resetVotingResult = $bool;
24 private $answerCopier =
null;
32 $this->answerCopier = $answerCopier;
52 $this->result->addErrors(
$result->getErrors());
69 $queryObject = QuestionTable::getById(
$entityId);
91 if ($this->resetVotingResult)
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=[])
setAnswerCopier(EntityCopier $answerCopier)
getFields(Container $container, $entityId)
setResetVotingResult(bool $bool)
add(Container $container, array $fields)
copyChildren(Container $container, $entityId, $copiedEntityId)
prepareFieldsToCopy(Container $container, array $fields)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)