Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
agentcontractfiletable.php
1
<?php
2
3
namespace
Bitrix\Catalog
;
4
5
use
Bitrix\Main\Application
;
6
use Bitrix\Main\Entity\EventResult;
7
use
Bitrix\Main\Localization\Loc
;
8
use
Bitrix\Main\ORM\Data\DataManager
;
9
use
Bitrix\Main\ORM\Event
;
10
use
Bitrix\Main\ORM\Fields\IntegerField
;
11
use
Bitrix\Main\ORM\Fields\Relations\Reference
;
12
39
class
AgentContractFileTable
extends
DataManager
40
{
46
public
static
function
getTableName
(): string
47
{
48
return
'b_catalog_agent_contract_file'
;
49
}
50
56
public
static
function
getMap
(): array
57
{
58
return
[
59
'ID'
=>
new
IntegerField
(
60
'ID'
,
61
[
62
'primary'
=>
true
,
63
'autocomplete'
=>
true
,
64
'title'
=>
Loc::getMessage
(
'AGENT_CONTRACT_FILE_ENTITY_ID_FIELD'
),
65
]
66
),
67
'CONTRACT_ID'
=>
new
IntegerField
(
68
'CONTRACT_ID'
,
69
[
70
'required'
=>
true
,
71
'title'
=>
Loc::getMessage
(
'AGENT_CONTRACT_FILE_ENTITY_CONTRACT_ID_FIELD'
),
72
]
73
),
74
'CONTRACT'
=>
new
Reference
(
75
'CONTRACT'
,
76
'\Bitrix\Catalog\AgentContractTable'
,
77
[
'=this.CONTRACT_ID'
=>
'ref.ID'
],
78
),
79
'FILE_ID'
=>
new
IntegerField
(
80
'FILE_ID'
,
81
[
82
'required'
=>
true
,
83
'title'
=>
Loc::getMessage
(
'AGENT_CONTRACT_FILE_ENTITY_FILE_ID_FIELD'
),
84
]
85
),
86
'FILE'
=>
new
Reference
(
87
'FILE'
,
88
'\Bitrix\Main\FileTable'
,
89
[
'=this.FILE_ID'
=>
'ref.ID'
],
90
),
91
];
92
}
93
94
public
static
function
deleteFilesByContractId
(
int
$contractId): void
95
{
96
$agentContractFileIterator =
self::getList
([
97
'select'
=> [
'ID'
,
'FILE_ID'
],
98
'filter'
=> [
'=CONTRACT_ID'
=> $contractId],
99
]);
100
while
($agentContractFile = $agentContractFileIterator->fetch())
101
{
102
\CFile::Delete($agentContractFile[
'FILE_ID'
]);
103
self::delete
($agentContractFile[
'ID'
]);
104
}
105
}
106
}
Bitrix\Catalog\AgentContractFileTable
Definition
agentcontractfiletable.php:40
Bitrix\Catalog\AgentContractFileTable\getMap
static getMap()
Definition
agentcontractfiletable.php:56
Bitrix\Catalog\AgentContractFileTable\deleteFilesByContractId
static deleteFilesByContractId(int $contractId)
Definition
agentcontractfiletable.php:94
Bitrix\Catalog\AgentContractFileTable\getTableName
static getTableName()
Definition
agentcontractfiletable.php:46
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Event
Definition
event.php:5
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\Data\DataManager\getList
static getList(array $parameters=array())
Definition
datamanager.php:441
Bitrix\Main\ORM\Data\DataManager\delete
static delete($primary)
Definition
datamanager.php:1632
Bitrix\Main\ORM\Fields\IntegerField
Definition
integerfield.php:20
Bitrix\Main\ORM\Fields\Relations\Reference
Definition
reference.php:26
Bitrix\Catalog
modules
catalog
lib
agentcontractfiletable.php
Создано системой
1.10.0