- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/controller/timeline/comment.php
- Класс: Bitrix\Crm\Controller\Timeline\Comment
- Вызов: Comment::copy
protected function copy(int $commentId, int $ownerTypeId, int $ownerId, array $filesList): ?int
{
$commentData = $this->load($commentId);
$newCommentId = CommentEntry::create([
'CREATED' => $commentData->getCreated(),
'AUTHOR_ID' => $commentData->getAuthorId(),
'SETTINGS' => $commentData->getSettings(),
'TEXT' => $commentData->getComment(),
'FILES' => $filesList,
'BINDINGS' => [
[
'ENTITY_TYPE_ID' => $ownerTypeId,
'ENTITY_ID' => $ownerId
]
]
]);
$bindingDelete = $this->timelineBindingEntity::delete(array(
'OWNER_ID' => $commentId,
'ENTITY_ID' => $ownerId,
'ENTITY_TYPE_ID' => $ownerTypeId,
));
if ($bindingDelete->isSuccess())
{
CommentController::getInstance()->sendPullEventOnDelete(
new ItemIdentifier($ownerTypeId, $ownerId), $commentId
);
CommentController::getInstance()->sendPullEventOnAdd(
new ItemIdentifier($ownerTypeId, $ownerId), $newCommentId
);
$commentId = $newCommentId;
}
return $commentId;
}