1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
agentcontractfiletable.php
См. документацию.
1<?php
2
3namespace Bitrix\Catalog;
4
5use Bitrix\Main\Localization\Loc;
6use Bitrix\Main\ORM\Data\DataManager;
7use Bitrix\Main\ORM\Fields\IntegerField;
8use Bitrix\Main\ORM\Fields\Relations\Reference;
9
35
37{
43 public static function getTableName(): string
44 {
45 return 'b_catalog_agent_contract_file';
46 }
47
53 public static function getMap(): array
54 {
55 return [
56 'ID' => new IntegerField(
57 'ID',
58 [
59 'primary' => true,
60 'autocomplete' => true,
61 'title' => Loc::getMessage('AGENT_CONTRACT_FILE_ENTITY_ID_FIELD'),
62 ]
63 ),
64 'CONTRACT_ID' => new IntegerField(
65 'CONTRACT_ID',
66 [
67 'required' => true,
68 'title' => Loc::getMessage('AGENT_CONTRACT_FILE_ENTITY_CONTRACT_ID_FIELD'),
69 ]
70 ),
71 'CONTRACT' => new Reference(
72 'CONTRACT',
73 '\Bitrix\Catalog\AgentContractTable',
74 ['=this.CONTRACT_ID' => 'ref.ID'],
75 ),
76 'FILE_ID' => new IntegerField(
77 'FILE_ID',
78 [
79 'required' => true,
80 'title' => Loc::getMessage('AGENT_CONTRACT_FILE_ENTITY_FILE_ID_FIELD'),
81 ]
82 ),
83 'FILE' => new Reference(
84 'FILE',
85 '\Bitrix\Main\FileTable',
86 ['=this.FILE_ID' => 'ref.ID'],
87 ),
88 ];
89 }
90
91 public static function deleteFilesByContractId(int $contractId): void
92 {
93 $agentContractFileIterator = self::getList([
94 'select' => ['ID', 'FILE_ID'],
95 'filter' => ['=CONTRACT_ID' => $contractId],
96 ]);
97 while ($agentContractFile = $agentContractFileIterator->fetch())
98 {
99 \CFile::Delete($agentContractFile['FILE_ID']);
100 self::delete($agentContractFile['ID']);
101 }
102 }
103}
static deleteFilesByContractId(int $contractId)
Определения agentcontractfiletable.php:91
static getList(array $parameters=array())
Определения datamanager.php:431
static delete($primary)
Определения datamanager.php:1644
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804