Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
entity.php
1
<?php
2
3
4
namespace
Bitrix\Sale\Rest\Synchronization\Loader
;
5
6
7
use
Bitrix\Main\ArgumentException
;
8
use
Bitrix\Sale\Registry
;
9
10
class
Entity
11
{
12
protected
$params
;
13
protected
$typeName
;
14
15
public
function
__construct
(
$typeName
,
$params
=[])
16
{
17
$this->typeName =
$typeName
;
18
$this->params =
$params
;
19
}
20
21
protected
function
getAdditionalFilterFileds
()
22
{
23
return
[];
24
}
25
26
protected
function
getExternalNameField
()
27
{
28
return
'XML_ID'
;
29
}
30
31
protected
function
getFields
()
32
{
33
return
[
'ID'
, $this->
getExternalNameField
()];
34
}
35
36
public
function
getParams
()
37
{
38
return
$this->params
;
39
}
40
41
public
function
getFieldsByExternalId
($xmlId)
42
{
43
if
($xmlId ===
""
)
44
{
45
return
null
;
46
}
47
48
$entity = $this->
getEntityTable
();
49
50
if
($r = $entity::getList([
51
'select'
=> $this->
getFields
(),
52
'filter'
=> array_merge(
53
[
54
$this->
getExternalNameField
() => $xmlId
55
],
56
$this->
getAdditionalFilterFileds
()
57
),
58
'order'
=> [
'ID'
=>
'ASC'
]
59
])->fetch()
60
)
61
{
62
return
$r[
'ID'
];
63
}
64
65
return
null
;
66
}
67
68
public
function
getRegistryType
()
69
{
70
return
Registry::REGISTRY_TYPE_ORDER
;
71
}
72
73
protected
function
getEntityTable
()
74
{
75
$instance =
Registry::getInstance
($this->
getRegistryType
());
76
return
$instance->get($this->typeName);
77
}
78
}
Bitrix\Main\ArgumentException
Definition
exception.php:34
Bitrix\Sale\Registry
Definition
registry.php:13
Bitrix\Sale\Registry\getInstance
static getInstance($type)
Definition
registry.php:183
Bitrix\Sale\Registry\REGISTRY_TYPE_ORDER
const REGISTRY_TYPE_ORDER
Definition
registry.php:16
Bitrix\Sale\Rest\Synchronization\Loader\Entity
Definition
entity.php:11
Bitrix\Sale\Rest\Synchronization\Loader\Entity\$typeName
$typeName
Definition
entity.php:13
Bitrix\Sale\Rest\Synchronization\Loader\Entity\getAdditionalFilterFileds
getAdditionalFilterFileds()
Definition
entity.php:21
Bitrix\Sale\Rest\Synchronization\Loader\Entity\getEntityTable
getEntityTable()
Definition
entity.php:73
Bitrix\Sale\Rest\Synchronization\Loader\Entity\__construct
__construct($typeName, $params=[])
Definition
entity.php:15
Bitrix\Sale\Rest\Synchronization\Loader\Entity\getExternalNameField
getExternalNameField()
Definition
entity.php:26
Bitrix\Sale\Rest\Synchronization\Loader\Entity\getRegistryType
getRegistryType()
Definition
entity.php:68
Bitrix\Sale\Rest\Synchronization\Loader\Entity\getFieldsByExternalId
getFieldsByExternalId($xmlId)
Definition
entity.php:41
Bitrix\Sale\Rest\Synchronization\Loader\Entity\getParams
getParams()
Definition
entity.php:36
Bitrix\Sale\Rest\Synchronization\Loader\Entity\$params
$params
Definition
entity.php:12
Bitrix\Sale\Rest\Synchronization\Loader\Entity\getFields
getFields()
Definition
entity.php:31
Bitrix\Sale\Rest\Synchronization\Loader
Definition
basketitem.php:4
modules
sale
lib
rest
synchronization
loader
entity.php
Создано системой
1.10.0