Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
storedocumentbarcodetable.php
1
<?php
2
namespace
Bitrix\Catalog
;
3
4
use
Bitrix\Main\Application
;
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\Relations\Reference
;
9
use
Bitrix\Main\ORM\Fields\StringField
;
10
use
Bitrix\Main\ORM\Fields\Validators\LengthValidator
;
11
41
class
StoreDocumentBarcodeTable
extends
DataManager
42
{
48
public
static
function
getTableName
()
49
{
50
return
'b_catalog_docs_barcode'
;
51
}
52
58
public
static
function
getMap
()
59
{
60
return
[
61
'ID'
=>
new
IntegerField
(
62
'ID'
,
63
[
64
'primary'
=>
true
,
65
'autocomplete'
=>
true
,
66
'title'
=>
Loc::getMessage
(
'INVENTORY_DOCUMENT_BARCODE_ENTITY_ID_FIELD'
),
67
]
68
),
69
'DOC_ID'
=>
new
IntegerField
(
70
'DOC_ID'
,
71
[
72
'required'
=>
true
,
73
'title'
=>
Loc::getMessage
(
'INVENTORY_DOCUMENT_BARCODE_ENTITY_DOC_ID_FIELD'
),
74
]
75
),
76
'DOC_ELEMENT_ID'
=>
new
IntegerField
(
77
'DOC_ELEMENT_ID'
,
78
[
79
'required'
=>
true
,
80
'title'
=>
Loc::getMessage
(
'INVENTORY_DOCUMENT_BARCODE_ENTITY_DOC_ELEMENT_ID_FIELD'
),
81
]
82
),
83
'BARCODE'
=>
new
StringField
(
84
'BARCODE'
,
85
[
86
'required'
=>
true
,
87
'validation'
=>
function
()
88
{
89
return
[
90
new
LengthValidator
(
null
, 100),
91
];
92
},
93
'title'
=>
Loc::getMessage
(
'INVENTORY_DOCUMENT_BARCODE_ENTITY_BARCODE_FIELD'
),
94
]
95
),
96
'DOCUMENT'
=>
new
Reference
(
97
'DOCUMENT'
,
98
'\Bitrix\Catalog\StoreDocument'
,
99
[
'=this.DOC_ID'
=>
'ref.ID'
],
100
[
'join_type'
=>
'LEFT'
]
101
),
102
'DOCUMENT_ELEMENT'
=>
new
Reference
(
103
'DOCUMENT_ELEMENT'
,
104
'\Bitrix\Catalog\StoreDocumentElement'
,
105
[
'=this.DOC_ELEMENT_ID'
=>
'ref.ID'
],
106
[
'join_type'
=>
'LEFT'
]
107
),
108
];
109
}
110
118
public
static
function
deleteByDocument
(
int
$id): void
119
{
120
if
($id <= 0)
121
{
122
return
;
123
}
124
125
$conn =
Application::getConnection
();
126
$helper = $conn->getSqlHelper();
127
$conn->queryExecute(
128
'delete from '
. $helper->quote(self::getTableName())
129
.
' where '
. $helper->quote(
'DOC_ID'
) .
' = '
. $id
130
);
131
unset($helper, $conn);
132
}
133
}
Bitrix\Catalog\StoreDocumentBarcodeTable
Definition
storedocumentbarcodetable.php:42
Bitrix\Catalog\StoreDocumentBarcodeTable\getMap
static getMap()
Definition
storedocumentbarcodetable.php:58
Bitrix\Catalog\StoreDocumentBarcodeTable\deleteByDocument
static deleteByDocument(int $id)
Definition
storedocumentbarcodetable.php:118
Bitrix\Catalog\StoreDocumentBarcodeTable\getTableName
static getTableName()
Definition
storedocumentbarcodetable.php:48
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getConnection
static getConnection($name="")
Definition
application.php:611
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\IntegerField
Definition
integerfield.php:20
Bitrix\Main\ORM\Fields\Relations\Reference
Definition
reference.php:26
Bitrix\Main\ORM\Fields\StringField
Definition
stringfield.php:20
Bitrix\Main\ORM\Fields\Validators\LengthValidator
Definition
lengthvalidator.php:19
Bitrix\Catalog
modules
catalog
lib
storedocumentbarcodetable.php
Создано системой
1.10.0