Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
UrlItem.php
1
<?php
2
3
namespace
Bitrix\Im\V2\Link\Url
;
4
5
use Bitrix\Im\Model\EO_LinkUrl;
6
use
Bitrix\Im\Model\LinkUrlIndexTable
;
7
use
Bitrix\Im\Model\LinkUrlTable
;
8
use Bitrix\Im\V2\Common\MigrationStatusCheckerTrait;
9
use
Bitrix\Im\V2\Entity
;
10
use
Bitrix\Im\V2\Link\BaseLinkItem
;
11
use
Bitrix\Im\V2\Rest\RestEntity
;
12
use
Bitrix\Main\ArgumentTypeException
;
13
use
Bitrix\Im\V2\Result
;
14
15
class
UrlItem
extends
BaseLinkItem
16
{
17
use MigrationStatusCheckerTrait;
18
19
protected
static
string
$migrationOptionName
=
'im_link_url_migration'
;
20
21
protected
string
$url
;
22
26
public
function
__construct
($source =
null
)
27
{
28
$this->initByDefault();
29
30
if
(!empty($source))
31
{
32
$this->
load
($source);
33
}
34
}
35
36
public
static
function
getRestEntityName
(): string
37
{
38
return
'link'
;
39
}
40
41
public
static
function
getEntityClassName
(): string
42
{
43
return
Entity\Url\UrlItem::class;
44
}
45
46
public
function
save
():
Result
47
{
48
if
(!static::isMigrationFinished())
49
{
50
return
new
Result
();
51
}
52
53
$result = parent::save();
54
LinkUrlIndexTable::indexInBackground();
55
56
return
$result;
57
}
58
59
public
function
delete
():
Result
60
{
61
LinkUrlIndexTable::delete($this->
getPrimaryId
());
62
63
return
parent::delete();
64
}
65
66
public
static
function
getDataClass
(): string
67
{
68
return
LinkUrlTable::class;
69
}
70
71
protected
static
function
getEntityIdFieldName
(): string
72
{
73
return
'PREVIEW_URL_ID'
;
74
}
75
76
protected
static
function
mirrorDataEntityFields
(): array
77
{
78
$additionalFields = [
79
'URL'
=> [
80
'field'
=>
'url'
,
81
'set'
=>
'setUrl'
,
82
'get'
=>
'getUrl'
,
83
]
84
];
85
86
return
array_merge(parent::mirrorDataEntityFields(), $additionalFields);
87
}
88
89
//region Setters & getters
90
94
public
function
getEntity
(): \
Bitrix
\Im\V2\
Entity
\Url\
UrlItem
95
{
96
return
$this->entity
;
97
}
98
103
public
function
setEntity
(
RestEntity
$entity
): self
104
{
105
if
(!(
$entity
instanceof \
Bitrix
\Im\V2\
Entity
\Url\
UrlItem
))
106
{
107
throw
new
ArgumentTypeException
(get_class(
$entity
));
108
}
109
$this->
setUrl
($entity->getUrl());
110
111
return
parent::setEntity(
$entity
);
112
}
113
114
public
function
getUrl
(): string
115
{
116
return
$this->url
;
117
}
118
119
public
function
setUrl
(
string
$url
): self
120
{
121
$this->url =
$url
;
122
return
$this;
123
}
124
125
//endregion
126
}
Bitrix\Im\Model\LinkUrlIndexTable
Definition
linkurlindex.php:44
Bitrix\Im\Model\LinkUrlTable
Definition
linkurl.php:52
Bitrix\Im\V2\Link\BaseLinkItem
Definition
BaseLinkItem.php:18
Bitrix\Im\V2\Link\BaseLinkItem\getPrimaryId
getPrimaryId()
Definition
BaseLinkItem.php:78
Bitrix\Im\V2\Link\BaseLinkItem\$entity
RestEntity $entity
Definition
BaseLinkItem.php:29
Bitrix\Im\V2\Link\Url\UrlItem
Definition
UrlItem.php:16
Bitrix\Im\V2\Link\Url\UrlItem\getRestEntityName
static getRestEntityName()
Definition
UrlItem.php:36
Bitrix\Im\V2\Link\Url\UrlItem\getEntity
getEntity()
Definition
UrlItem.php:94
Bitrix\Im\V2\Link\Url\UrlItem\getEntityClassName
static getEntityClassName()
Definition
UrlItem.php:41
Bitrix\Im\V2\Link\Url\UrlItem\__construct
__construct($source=null)
Definition
UrlItem.php:26
Bitrix\Im\V2\Link\Url\UrlItem\$migrationOptionName
static string $migrationOptionName
Definition
UrlItem.php:19
Bitrix\Im\V2\Link\Url\UrlItem\setEntity
setEntity(RestEntity $entity)
Definition
UrlItem.php:103
Bitrix\Im\V2\Link\Url\UrlItem\getEntityIdFieldName
static getEntityIdFieldName()
Definition
UrlItem.php:71
Bitrix\Im\V2\Link\Url\UrlItem\getDataClass
static getDataClass()
Definition
UrlItem.php:66
Bitrix\Im\V2\Link\Url\UrlItem\$url
string $url
Definition
UrlItem.php:21
Bitrix\Im\V2\Link\Url\UrlItem\getUrl
getUrl()
Definition
UrlItem.php:114
Bitrix\Im\V2\Link\Url\UrlItem\setUrl
setUrl(string $url)
Definition
UrlItem.php:119
Bitrix\Im\V2\Link\Url\UrlItem\mirrorDataEntityFields
static mirrorDataEntityFields()
Definition
UrlItem.php:76
Bitrix\Im\V2\Link\Url\UrlItem\save
save()
Definition
UrlItem.php:46
Bitrix\Im\V2\Result
Definition
Result.php:9
Bitrix\Main\ArgumentTypeException
Definition
exception.php:114
Bitrix\Im\V2\ActiveRecord\load
load($source)
Bitrix\Im\V2\Entity
Definition
Entity.php:6
Bitrix\Im\V2\Rest\RestEntity
Definition
RestEntity.php:8
Bitrix\Im\V2\Entity
Bitrix\Im\V2\Link\Url
Definition
UrlCollection.php:3
Bitrix
modules
im
lib
V2
Link
Url
UrlItem.php
Создано системой
1.10.0