Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
addresslinktable.php
1
<?php
2
3
namespace
Bitrix\Location\Model
;
4
5
use
Bitrix\Main
;
6
use
Bitrix\Main\ORM\Fields
;
7
use
Bitrix\Main\ORM\Query\Join
;
8
25
class
AddressLinkTable
extends
Main\ORM\Data\DataManager
26
{
32
public
static
function
getTableName
()
33
{
34
return
'b_location_addr_link'
;
35
}
36
42
public
static
function
getMap
()
43
{
44
return
[
45
46
(
new
Fields\IntegerField(
'ADDRESS_ID'
))
47
->configurePrimary(
true
),
48
49
(
new
Fields\StringField(
'ENTITY_ID'
))
50
->configurePrimary(
true
)
51
->addValidator(
new
Main\ORM\Fields\Validators\
LengthValidator
(1, 100)),
52
53
// todo: int
54
(
new
Fields\
StringField
(
'ENTITY_TYPE'
))
55
->configurePrimary(
true
)
56
->addValidator(
new
Main\ORM\Fields\Validators\
LengthValidator
(1, 50)),
57
58
// Ref
59
60
(
new
Fields\Relations\
Reference
(
'ADDRESS'
, AddressTable::class,
61
Join::on(
'this.ADDRESS_ID'
,
'ref.ID'
)))
62
->configureJoinType(
'inner'
)
63
];
64
}
65
70
public
static
function
deleteByAddressId
(
int
$addressId): void
71
{
72
Main\Application::getConnection()->queryExecute(
"
73
DELETE
74
FROM "
.self::getTableName().
"
75
WHERE
76
ADDRESS_ID="
.(
int
)$addressId
77
);
78
}
79
84
public
static
function
deleteByEntityType
(
string
$entityType): void
85
{
86
$connection = Main\Application::getConnection();
87
$sqlHelper = $connection->getSqlHelper();
88
89
Main\Application::getConnection()->queryExecute(
"
90
DELETE
91
FROM "
.self::getTableName().
"
92
WHERE
93
ENTITY_TYPE = '"
.$sqlHelper->forSql($entityType).
"'"
94
);
95
}
96
}
Bitrix\Location\Model\AddressLinkTable
Definition
addresslinktable.php:26
Bitrix\Location\Model\AddressLinkTable\deleteByEntityType
static deleteByEntityType(string $entityType)
Definition
addresslinktable.php:84
Bitrix\Location\Model\AddressLinkTable\getMap
static getMap()
Definition
addresslinktable.php:42
Bitrix\Location\Model\AddressLinkTable\deleteByAddressId
static deleteByAddressId(int $addressId)
Definition
addresslinktable.php:70
Bitrix\Location\Model\AddressLinkTable\getTableName
static getTableName()
Definition
addresslinktable.php:32
Bitrix\Main\ORM\Data\DataManager
Definition
datamanager.php:33
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\Main\ORM\Query\Join
Definition
join.php:19
Bitrix\Location\Model
Definition
addressfieldtable.php:3
Bitrix\Main\ORM\Fields
Definition
arrayfield.php:9
Bitrix\Main
modules
location
lib
model
addresslinktable.php
Создано системой
1.10.0