Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
blogcomment.php
1
<?php
2
namespace
Bitrix\Blog\Copy\Implement
;
3
4
use
Bitrix\Main\Copy\Container
;
5
use
Bitrix\Main\Error
;
6
use
Bitrix\Main\Result
;
7
8
class
BlogComment
extends
Base
9
{
10
const
BLOG_COMMENT_COPY_ERROR
=
"BLOG_COMMENT_COPY_ERROR"
;
11
12
protected
$ufEntityObject
=
"BLOG_COMMENT"
;
13
protected
$ufDiskFileField
=
"UF_BLOG_COMMENT_FILE"
;
14
22
public
function
add
(
Container
$container, array $fields)
23
{
24
$commentId = \CBlogComment::add($fields);
25
26
if
(!$commentId)
27
{
28
$this->result->addError(
new
Error
(
"Blog comment hasn't been added"
, self::BLOG_COMMENT_COPY_ERROR));
29
}
30
31
return
$commentId;
32
}
33
41
public
function
getFields
(
Container
$container, $entityId)
42
{
43
$queryObject = \CBlogComment::getlist([], [
"ID"
=> $entityId],
false
,
false
, [
"*"
]);
44
45
return
(($fields = $queryObject->fetch()) ? $fields : []);
46
}
47
55
public
function
prepareFieldsToCopy
(
Container
$container, array $fields)
56
{
57
unset($fields[
"ID"
]);
58
59
if
($container->
getParentId
())
60
{
61
$fields[
"POST_ID"
] = $container->
getParentId
();
62
}
63
64
return
$fields;
65
}
66
75
public
function
copyChildren
(
Container
$container, $entityId, $copiedEntityId)
76
{
77
$this->
copyUfFields
($entityId, $copiedEntityId, $this->ufEntityObject);
78
79
return
new
Result
();
80
}
81
82
public
function
update
($entityId, array $fields)
83
{
84
return \CBlogComment::update($entityId, $fields);
85
}
86
87
public
function
getText
($entityId)
88
{
89
$queryObject = \CBlogComment::getlist([], [
"ID"
=> $entityId],
false
,
false
, [
"POST_TEXT"
]);
90
91
if
($fields = $queryObject->fetch())
92
{
93
return
[
"POST_TEXT"
, $fields[
"POST_TEXT"
]];
94
}
95
else
96
{
97
return
[
"POST_TEXT"
,
""
];
98
}
99
}
100
}
Bitrix\Blog\Copy\Implement\Base
Definition
base.php:7
Bitrix\Blog\Copy\Implement\BlogComment
Definition
blogcomment.php:9
Bitrix\Blog\Copy\Implement\BlogComment\$ufEntityObject
$ufEntityObject
Definition
blogcomment.php:12
Bitrix\Blog\Copy\Implement\BlogComment\getText
getText($entityId)
Definition
blogcomment.php:87
Bitrix\Blog\Copy\Implement\BlogComment\BLOG_COMMENT_COPY_ERROR
const BLOG_COMMENT_COPY_ERROR
Definition
blogcomment.php:10
Bitrix\Blog\Copy\Implement\BlogComment\$ufDiskFileField
$ufDiskFileField
Definition
blogcomment.php:13
Bitrix\Blog\Copy\Implement\BlogComment\update
update($entityId, array $fields)
Definition
blogcomment.php:82
Bitrix\Blog\Copy\Implement\BlogComment\getFields
getFields(Container $container, $entityId)
Definition
blogcomment.php:41
Bitrix\Blog\Copy\Implement\BlogComment\add
add(Container $container, array $fields)
Definition
blogcomment.php:22
Bitrix\Blog\Copy\Implement\BlogComment\copyChildren
copyChildren(Container $container, $entityId, $copiedEntityId)
Definition
blogcomment.php:75
Bitrix\Blog\Copy\Implement\BlogComment\prepareFieldsToCopy
prepareFieldsToCopy(Container $container, array $fields)
Definition
blogcomment.php:55
Bitrix\Main\Copy\Container
Definition
container.php:12
Bitrix\Main\Copy\Container\getParentId
getParentId()
Definition
container.php:70
Bitrix\Main\Copy\CopyImplementer\copyUfFields
copyUfFields(int $entityId, int $copiedEntityId, string $ufObject)
Definition
copyimplementer.php:67
Bitrix\Main\Error
Definition
error.php:14
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Main\Result
Definition
result.php:14
Bitrix\Blog\Copy\Implement
Definition
base.php:2
modules
blog
lib
copy
implement
blogcomment.php
Создано системой
1.10.0