Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
answer.php
1
<?php
2
namespace
Bitrix\Vote\Copy\Implement
;
3
4
use
Bitrix\Main\Copy\Container
;
5
use
Bitrix\Main\Copy\CopyImplementer
;
6
use
Bitrix\Main\Result
;
7
use
Bitrix\Vote\AnswerTable
;
8
9
class
Answer
extends
CopyImplementer
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
}
Bitrix\Main\Copy\Container
Definition
container.php:12
Bitrix\Main\Copy\Container\getParentId
getParentId()
Definition
container.php:70
Bitrix\Main\Copy\CopyImplementer
Definition
copyimplementer.php:11
Bitrix\Main\Copy\CopyImplementer\$result
$result
Definition
copyimplementer.php:15
Bitrix\Main\Copy\CopyImplementer\getResult
getResult(array $results=[])
Definition
copyimplementer.php:119
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Vote\AnswerTable
Definition
answer.php:52
Bitrix\Vote\Copy\Implement\Answer
Definition
answer.php:10
Bitrix\Vote\Copy\Implement\Answer\getFields
getFields(Container $container, $entityId)
Definition
answer.php:50
Bitrix\Vote\Copy\Implement\Answer\setResetVotingResult
setResetVotingResult(bool $bool)
Definition
answer.php:13
Bitrix\Vote\Copy\Implement\Answer\add
add(Container $container, array $fields)
Definition
answer.php:26
Bitrix\Vote\Copy\Implement\Answer\copyChildren
copyChildren(Container $container, $entityId, $copiedEntityId)
Definition
answer.php:88
Bitrix\Vote\Copy\Implement\Answer\prepareFieldsToCopy
prepareFieldsToCopy(Container $container, array $fields)
Definition
answer.php:63
Bitrix\Vote\Copy\Implement
Definition
answer.php:2
modules
vote
lib
copy
implement
answer.php
Создано системой
1.10.0