Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
typefactory.php
1
<?php
2
3
namespace
Bitrix\Main\UserField\Internal
;
4
8
abstract
class
TypeFactory
9
{
10
protected
$itemEntities
= [];
11
15
abstract
public
function
getTypeDataClass
(): string;
16
20
abstract
public
function
getItemPrototypeDataClass
(): string;
21
22
abstract
public
function
getCode
(): string;
23
28
public
function
getItemDataClass
($type): string
29
{
30
return
$this->
getItemEntity
($type)->getDataClass();
31
}
32
33
public
function
getItemEntity
($type): \
Bitrix
\Main\ORM\
Entity
34
{
35
$typeData = $this->
getTypeDataClass
()::resolveType($type);
36
if
(!empty($typeData) && isset($this->itemEntities[$typeData[
'ID'
]]))
37
{
38
return
$this->itemEntities[$typeData[
'ID'
]];
39
}
40
41
$entity = $this->
getTypeDataClass
()::compileEntity($type);
42
$this->itemEntities[$typeData[
'ID'
]] = $entity;
43
44
return
$entity;
45
}
46
50
public
function
getItemParentClass
(): string
51
{
52
return
Item::class;
53
}
54
55
public
function
getUserFieldEntityPrefix
(): string
56
{
57
$code = $this->
getCode
();
58
return
static::getPrefixByCode($code).
'_'
;
59
}
60
61
public
function
getUserFieldEntityId
(
int
$typeId): string
62
{
63
return
$this->
getUserFieldEntityPrefix
().$typeId;
64
}
65
66
public
static
function
getCodeByPrefix
(
string
$prefix): string
67
{
68
return
mb_strtolower($prefix);
69
}
70
71
public
static
function
getPrefixByCode
(
string
$code): string
72
{
73
return
mb_strtoupper($code);
74
}
75
76
public
function
prepareIdentifier
($identifier)
77
{
78
return
(
int
)$identifier;
79
}
80
}
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Main\UserField\Internal\TypeFactory
Definition
typefactory.php:9
Bitrix\Main\UserField\Internal\TypeFactory\prepareIdentifier
prepareIdentifier($identifier)
Definition
typefactory.php:76
Bitrix\Main\UserField\Internal\TypeFactory\getItemDataClass
getItemDataClass($type)
Definition
typefactory.php:28
Bitrix\Main\UserField\Internal\TypeFactory\getPrefixByCode
static getPrefixByCode(string $code)
Definition
typefactory.php:71
Bitrix\Main\UserField\Internal\TypeFactory\getItemEntity
getItemEntity($type)
Definition
typefactory.php:33
Bitrix\Main\UserField\Internal\TypeFactory\getTypeDataClass
getTypeDataClass()
Bitrix\Main\UserField\Internal\TypeFactory\$itemEntities
$itemEntities
Definition
typefactory.php:10
Bitrix\Main\UserField\Internal\TypeFactory\getCode
getCode()
Bitrix\Main\UserField\Internal\TypeFactory\getUserFieldEntityId
getUserFieldEntityId(int $typeId)
Definition
typefactory.php:61
Bitrix\Main\UserField\Internal\TypeFactory\getCodeByPrefix
static getCodeByPrefix(string $prefix)
Definition
typefactory.php:66
Bitrix\Main\UserField\Internal\TypeFactory\getUserFieldEntityPrefix
getUserFieldEntityPrefix()
Definition
typefactory.php:55
Bitrix\Main\UserField\Internal\TypeFactory\getItemPrototypeDataClass
getItemPrototypeDataClass()
Bitrix\Main\UserField\Internal\TypeFactory\getItemParentClass
getItemParentClass()
Definition
typefactory.php:50
Bitrix\Main\UserField\Internal
Definition
item.php:3
Bitrix
modules
main
lib
userfield
internal
typefactory.php
Создано системой
1.10.0