Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
ExportedProductTable.php
1
<?php
2
3
namespace
Bitrix\Catalog\v2\Integration\Seo\Entity
;
4
5
use
Bitrix\Main\Entity
;
6
use
Bitrix\Main\Localization\Loc
;
7
use
Bitrix\Main\ORM\Fields\Validators\LengthValidator
;
8
use
Bitrix\Main\Type\DateTime
;
9
10
Loc::loadMessages
(__FILE__);
11
28
class
ExportedProductTable
extends
Entity\DataManager
29
{
30
public
static
function
getTableName
()
31
{
32
return
'b_catalog_exported_product'
;
33
}
34
35
public
static
function
getObjectClass
()
36
{
37
return
ExportedProduct::class;
38
}
39
40
public
static
function
getCollectionClass
()
41
{
42
return
ExportedProductCollection::class;
43
}
44
45
public
static
function
getMap
()
46
{
47
return
[
48
'ID'
=> [
49
'data_type'
=>
'integer'
,
50
'primary'
=>
true
,
51
],
52
'PRODUCT_ID'
=> [
53
'data_type'
=>
'integer'
,
54
'required'
=>
true
,
55
],
56
'SERVICE_ID'
=> [
57
'data_type'
=>
'string'
,
58
'validation'
=> [__CLASS__,
'validateServiceId'
],
59
'required'
=>
true
,
60
],
61
'TIMESTAMP_X'
=> [
62
'data_type'
=>
'datetime'
,
63
'required'
=>
true
,
64
'default_value'
=> [__CLASS__,
'getCurrentDate'
],
65
],
66
'ERROR'
=> [
67
'data_type'
=>
'text'
,
68
'required'
=>
false
,
69
],
70
];
71
}
72
73
public
static
function
validateServiceId
(): array
74
{
75
return
[
76
new
LengthValidator
(
null
, 100),
77
];
78
}
79
80
public
static
function
getCurrentDate
():
DateTime
81
{
82
return
new
DateTime
();
83
}
84
85
public
static
function
deleteProduct
(
int
$id): void
86
{
87
if
($id <= 0)
88
{
89
return
;
90
}
91
92
$conn = \Bitrix\Main\Application::getConnection();
93
$helper = $conn->getSqlHelper();
94
$conn->queryExecute(
95
'delete from '
. $helper->quote(self::getTableName())
96
.
' where '
. $helper->quote(
'PRODUCT_ID'
) .
' = '
. $id
97
);
98
unset($helper, $conn);
99
}
100
101
}
Bitrix\Catalog\v2\Integration\Seo\Entity\ExportedProductTable
Definition
ExportedProductTable.php:29
Bitrix\Catalog\v2\Integration\Seo\Entity\ExportedProductTable\getCurrentDate
static getCurrentDate()
Definition
ExportedProductTable.php:80
Bitrix\Catalog\v2\Integration\Seo\Entity\ExportedProductTable\getMap
static getMap()
Definition
ExportedProductTable.php:45
Bitrix\Catalog\v2\Integration\Seo\Entity\ExportedProductTable\validateServiceId
static validateServiceId()
Definition
ExportedProductTable.php:73
Bitrix\Catalog\v2\Integration\Seo\Entity\ExportedProductTable\deleteProduct
static deleteProduct(int $id)
Definition
ExportedProductTable.php:85
Bitrix\Catalog\v2\Integration\Seo\Entity\ExportedProductTable\getObjectClass
static getObjectClass()
Definition
ExportedProductTable.php:35
Bitrix\Catalog\v2\Integration\Seo\Entity\ExportedProductTable\getTableName
static getTableName()
Definition
ExportedProductTable.php:30
Bitrix\Catalog\v2\Integration\Seo\Entity\ExportedProductTable\getCollectionClass
static getCollectionClass()
Definition
ExportedProductTable.php:40
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Main\ORM\Fields\Validators\LengthValidator
Definition
lengthvalidator.php:19
Bitrix\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Catalog\v2\Integration\Seo\Entity
Definition
ExportedProduct.php:3
modules
catalog
lib
v2
Integration
Seo
Entity
ExportedProductTable.php
Создано системой
1.10.0