Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
storeproduct.php
1<?php
2namespace Bitrix\Catalog;
3
7
39{
45 public static function getTableName()
46 {
47 return 'b_catalog_store_product';
48 }
49
55 public static function getMap()
56 {
57 return [
58 'ID' => new ORM\Fields\IntegerField(
59 'ID',
60 [
61 'primary' => true,
62 'autocomplete' => true,
63 'title' => Loc::getMessage('STORE_PRODUCT_ENTITY_ID_FIELD'),
64 ]
65 ),
66 'STORE_ID' => new ORM\Fields\IntegerField(
67 'STORE_ID',
68 [
69 'required' => true,
70 'title' => Loc::getMessage('STORE_PRODUCT_ENTITY_STORE_ID_FIELD'),
71 ]
72 ),
73 'PRODUCT_ID' => new ORM\Fields\IntegerField(
74 'PRODUCT_ID',
75 [
76 'required' => true,
77 'title' => Loc::getMessage('STORE_PRODUCT_ENTITY_PRODUCT_ID_FIELD'),
78 ]
79 ),
80 'AMOUNT' => new ORM\Fields\FloatField(
81 'AMOUNT',
82 [
83 'title' => Loc::getMessage('STORE_PRODUCT_ENTITY_AMOUNT_FIELD'),
84 ]
85 ),
86 'QUANTITY_RESERVED' => new ORM\Fields\FloatField(
87 'QUANTITY_RESERVED',
88 [
89 'title' => Loc::getMessage('STORE_PRODUCT_ENTITY_QUANTITY_RESERVED_FIELD'),
90 ]
91 ),
92 'STORE' => new ORM\Fields\Relations\Reference(
93 'STORE',
94 StoreTable::class,
95 ORM\Query\Join::on('this.STORE_ID', 'ref.ID')
96 ),
97 'PRODUCT' => new ORM\Fields\Relations\Reference(
98 'PRODUCT',
99 ProductTable::class,
100 ORM\Query\Join::on('this.PRODUCT_ID', 'ref.ID')
101 ),
102 ];
103 }
104
112 public static function deleteByProduct(int $id): void
113 {
114 if ($id <= 0)
115 {
116 return;
117 }
118
119 $conn = Main\Application::getConnection();
120 $helper = $conn->getSqlHelper();
121 $conn->queryExecute(
122 'delete from ' . $helper->quote(self::getTableName())
123 . ' where ' . $helper->quote('PRODUCT_ID') . ' = ' . $id
124 );
125 unset($helper, $conn);
126 }
127}
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29