Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
storedocumentbarcodetable.php
1<?php
2namespace Bitrix\Catalog;
3
11
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
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}
static getConnection($name="")
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29