1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
Entity.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Seo\Sitemap\Internals
;
4
5
use
Bitrix\Main\Entity
;
6
7
class
EntityTable
extends
Entity\DataManager
8
{
9
const
ENTITY_TYPE
=
'ENTITY'
;
10
protected
static
array
$entityCache
= [];
11
12
public
static
function
getFilePath
(): string
13
{
14
return
__FILE__;
15
}
16
17
public
static
function
getTableName
()
18
{
19
return
'b_seo_sitemap_entity'
;
20
}
21
22
public
static
function
add
(
array
$data
)
23
{
24
$sitemapId =
$data
[
'SITEMAP_ID'
];
25
$entityId
=
$data
[
'ENTITY_ID'
];
26
return
parent::add(
array
(
27
'ENTITY_TYPE'
=> static::ENTITY_TYPE,
28
'ENTITY_ID'
=>
$entityId
,
29
'SITEMAP_ID'
=> $sitemapId,
30
));
31
}
32
33
public
static
function
getMap
()
34
{
35
$fieldsMap =
array
(
36
'ID'
=>
array
(
37
'data_type'
=>
'integer'
,
38
'primary'
=>
true
,
39
'autocomplete'
=>
true
,
40
),
41
'ENTITY_TYPE'
=>
array
(
42
'data_type'
=>
'string'
,
43
'required'
=>
true
,
44
),
45
'ENTITY_ID'
=>
array
(
46
'data_type'
=>
'integer'
,
47
'required'
=>
true
,
48
),
49
'SITEMAP_ID'
=>
array
(
50
'data_type'
=>
'integer'
,
51
'required'
=>
true
,
52
),
53
'SITEMAP'
=>
array
(
54
'data_type'
=>
'Bitrix\Seo\Sitemap\Internals\SitemapTable'
,
55
'reference'
=>
array
(
'=this.SITEMAP_ID'
=>
'ref.ID'
),
56
)
57
);
58
59
return
$fieldsMap;
60
}
61
62
public
static
function
getSitemapsByEntityId
(
$entityId
)
63
{
64
if
(!isset(self::$entityCache[
$entityId
.
'Sitemaps'
]))
65
{
66
self::$entityCache[$entityId] = array();
67
68
$dbRes = self::getList(array(
69
'filter'
=> array(
70
'=ENTITY_TYPE'
=> static::ENTITY_TYPE,
71
'=ENTITY_ID'
=> $entityId
72
),
73
'select'
=> array(
74
'SITEMAP_ID'
,
75
'SITE_ID'
=>
'SITEMAP.SITE_ID'
,
76
'SITEMAP_SETTINGS'
=>
'SITEMAP.SETTINGS'
77
)
78
));
79
$arSitemaps = array();
80
while($arRes = $dbRes->fetch())
81
{
82
$arRes[
"SITEMAP_SETTINGS"
] = unserialize($arRes[
'SITEMAP_SETTINGS'
], [
'allowed_classes'
=> false]);
83
self::$entityCache[$entityId][] = $arRes;
84
if ($arRes[
"SITEMAP_SETTINGS"
][static::ENTITY_TYPE.
"_ACTIVE"
] &&
85
$arRes[
"SITEMAP_SETTINGS"
][static::ENTITY_TYPE.
"_ACTIVE"
][$entityId] ==
"Y"
)
86
{
87
$arSitemaps[] = array(
88
'SITEMAP_ID'
=> $arRes[
'SITEMAP_ID'
],
89
'SITE_ID'
=> $arRes[
'SITE_ID'
],
90
'PROTOCOL'
=> $arRes[
"SITEMAP_SETTINGS"
][
'PROTO'
] == 1 ?
'https'
:
'http'
,
91
'DOMAIN'
=> $arRes[
"SITEMAP_SETTINGS"
][
'DOMAIN'
],
92
'ROBOTS'
=> $arRes[
"SITEMAP_SETTINGS"
][
'ROBOTS'
],
93
'SITEMAP_DIR'
=> $arRes[
"SITEMAP_SETTINGS"
][
'DIR'
],
94
'SITEMAP_FILE'
=> $arRes[
"SITEMAP_SETTINGS"
][
'FILENAME_INDEX'
],
95
'SITEMAP_FILE_'
.static::ENTITY_TYPE => $arRes[
"SITEMAP_SETTINGS"
][
'FILENAME_'
.static::ENTITY_TYPE],
96
'SITEMAP_SETTINGS'
=> $arRes[
"SITEMAP_SETTINGS"
]
97
);
98
}
99
}
100
self::$entityCache[
$entityId
.
'Sitemaps'
] = $arSitemaps;
101
}
102
103
return
self::$entityCache[
$entityId
.
'Sitemaps'
];
104
}
105
106
public
static
function
clearBySitemap
($sitemapId)
107
{
108
$connection
=
\Bitrix\Main\Application::getConnection
();
109
$connection
->query(
"
110
DELETE
111
FROM "
.self::getTableName().
"
112
WHERE SITEMAP_ID="
.intval($sitemapId).
" AND ENTITY_TYPE='"
.static::ENTITY_TYPE.
"'
113
"
);
114
}
115
}
$connection
$connection
Определения
actionsdefinitions.php:38
Bitrix\Main\Application\getConnection
static getConnection($name="")
Определения
application.php:638
Bitrix\Seo\Sitemap\Internals\EntityTable
Определения
Entity.php:8
Bitrix\Seo\Sitemap\Internals\EntityTable\getMap
static getMap()
Определения
Entity.php:33
Bitrix\Seo\Sitemap\Internals\EntityTable\getSitemapsByEntityId
static getSitemapsByEntityId($entityId)
Определения
Entity.php:62
Bitrix\Seo\Sitemap\Internals\EntityTable\clearBySitemap
static clearBySitemap($sitemapId)
Определения
Entity.php:106
Bitrix\Seo\Sitemap\Internals\EntityTable\getFilePath
static getFilePath()
Определения
Entity.php:12
Bitrix\Seo\Sitemap\Internals\EntityTable\$entityCache
static array $entityCache
Определения
Entity.php:10
Bitrix\Seo\Sitemap\Internals\EntityTable\add
static add(array $data)
Определения
Entity.php:22
Bitrix\Seo\Sitemap\Internals\EntityTable\ENTITY_TYPE
const ENTITY_TYPE
Определения
Entity.php:9
Bitrix\Seo\Sitemap\Internals\EntityTable\getTableName
static getTableName()
Определения
Entity.php:17
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Main\Entity
Определения
ufield.php:9
Bitrix\Seo\Sitemap\Internals
Определения
Entity.php:3
$entityId
$entityId
Определения
payment.php:4
bitrix
modules
seo
lib
Sitemap
Internals
Entity.php
Создано системой
1.14.0