Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
agentproducttable.php
1
<?php
2
3
namespace
Bitrix\Catalog
;
4
5
use
Bitrix\Main\Localization\Loc
;
6
use
Bitrix\Main\ORM\Data\DataManager
;
7
use
Bitrix\Main\ORM\Fields\IntegerField
;
8
use
Bitrix\Main\ORM\Fields\EnumField
;
9
use
Bitrix\Main\ORM\Fields\Validators\LengthValidator
;
10
use
Bitrix\Main\ORM\Fields\Relations\Reference
;
11
use
Bitrix\Main\ORM\Query\Join
;
12
39
class
AgentProductTable
extends
DataManager
40
{
41
public
const
PRODUCT_TYPE_PRODUCT
=
'PRODUCT'
;
42
public
const
PRODUCT_TYPE_SECTION
=
'SECTION'
;
43
49
public
static
function
getTableName
(): string
50
{
51
return
'b_catalog_agent_product'
;
52
}
53
59
public
static
function
getMap
(): array
60
{
61
return
[
62
'ID'
=>
new
IntegerField
(
63
'ID'
,
64
[
65
'primary'
=>
true
,
66
'autocomplete'
=>
true
,
67
'title'
=>
Loc::getMessage
(
'CATALOG_AGENT_PRODUCT_ENTITY_ID_FIELD'
),
68
]
69
),
70
'CONTRACT_ID'
=>
new
IntegerField
(
71
'CONTRACT_ID'
,
72
[
73
'required'
=>
true
,
74
'title'
=>
Loc::getMessage
(
'CATALOG_AGENT_PRODUCT_ENTITY_CONTRACT_ID_FIELD'
),
75
]
76
),
77
'CONTRACT'
=>
new
Reference
(
78
'CONTRACT'
,
79
AgentContractTable::class,
80
Join::on(
'this.CONTRACT_ID'
,
'ref.ID'
)
81
),
82
'PRODUCT_ID'
=>
new
IntegerField
(
83
'PRODUCT_ID'
,
84
[
85
'required'
=>
true
,
86
'title'
=>
Loc::getMessage
(
'CATALOG_AGENT_PRODUCT_ENTITY_PRODUCT_ID_FIELD'
),
87
]
88
),
89
'PRODUCT_TYPE'
=>
new
EnumField
(
90
'PRODUCT_TYPE'
,
91
[
92
'required'
=>
true
,
93
'values'
=> [self::PRODUCT_TYPE_PRODUCT, self::PRODUCT_TYPE_SECTION],
94
'validation'
=>
function
()
95
{
96
return
[
97
new
LengthValidator
(
null
, 8),
98
];
99
},
100
'title'
=>
Loc::getMessage
(
'AGENT_PRODUCT_ENTITY_PRODUCT_TYPE_FIELD'
),
101
]
102
),
103
];
104
}
105
}
Bitrix\Catalog\AgentProductTable
Definition
agentproducttable.php:40
Bitrix\Catalog\AgentProductTable\getMap
static getMap()
Definition
agentproducttable.php:59
Bitrix\Catalog\AgentProductTable\PRODUCT_TYPE_SECTION
const PRODUCT_TYPE_SECTION
Definition
agentproducttable.php:42
Bitrix\Catalog\AgentProductTable\PRODUCT_TYPE_PRODUCT
const PRODUCT_TYPE_PRODUCT
Definition
agentproducttable.php:41
Bitrix\Catalog\AgentProductTable\getTableName
static getTableName()
Definition
agentproducttable.php:49
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\ORM\Data\DataManager
Definition
datamanager.php:33
Bitrix\Main\ORM\Fields\EnumField
Definition
enumfield.php:20
Bitrix\Main\ORM\Fields\IntegerField
Definition
integerfield.php:20
Bitrix\Main\ORM\Fields\Relations\Reference
Definition
reference.php:26
Bitrix\Main\ORM\Fields\Validators\LengthValidator
Definition
lengthvalidator.php:19
Bitrix\Main\ORM\Query\Join
Definition
join.php:19
Bitrix\Catalog
modules
catalog
lib
agentproducttable.php
Создано системой
1.10.0