Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
answer.php
1<?php
3
8
10{
11 private $resetVotingResult = true;
12
13 public function setResetVotingResult(bool $bool): void
14 {
15 $this->resetVotingResult = $bool;
16 }
17
26 public function add(Container $container, array $fields)
27 {
28 $result = AnswerTable::add($fields);
29 if ($result->isSuccess())
30 {
31 return $result->getId();
32 }
33 else
34 {
35 $this->result->addErrors($result->getErrors());
36 return false;
37 }
38 }
39
50 public function getFields(Container $container, $entityId)
51 {
52 $queryObject = AnswerTable::getById($entityId);
53 return (($fields = $queryObject->fetch()) ? $fields : []);
54 }
55
63 public function prepareFieldsToCopy(Container $container, array $fields)
64 {
65 unset($fields["ID"]);
66
67 if ($container->getParentId())
68 {
69 $fields["QUESTION_ID"] = $container->getParentId();
70 }
71
72 if ($this->resetVotingResult)
73 {
74 unset($fields["COUNTER"]);
75 }
76
77 return $fields;
78 }
79
88 public function copyChildren(Container $container, $entityId, $copiedEntityId)
89 {
90 return $this->getResult();
91 }
92}
getFields(Container $container, $entityId)
Definition answer.php:50
add(Container $container, array $fields)
Definition answer.php:26
copyChildren(Container $container, $entityId, $copiedEntityId)
Definition answer.php:88
prepareFieldsToCopy(Container $container, array $fields)
Definition answer.php:63