Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
typemodel.php
1
<?php
2
3
namespace
Bitrix\Calendar\Access\Model
;
4
5
use
Bitrix\Calendar\Access\AccessibleType
;
6
use
Bitrix\Main\Access\AccessibleItem
;
7
8
class
TypeModel
implements
AccessibleType
9
{
10
private
static
array $cache = [];
11
12
private
int
$id = 0;
13
private
string
$xmlId =
''
;
14
15
public
static
function
createFromId
(
int
$itemId = 0):
AccessibleItem
16
{
17
return
new
self
();
18
}
19
20
public
static
function
createFromXmlId
(
string
$xmlId):
AccessibleItem
21
{
22
if
(!isset(static::$cache[$xmlId]))
23
{
24
$model =
new
self
();
25
$model->setXmlId($xmlId);
26
static::$cache[$xmlId] = $model;
27
}
28
29
return
static::$cache[$xmlId];
30
}
31
32
public
static
function
createNew
(): self
33
{
34
return
new
self
();
35
}
36
37
public
static
function
createFromSectionModel
(
SectionModel
$sectionModel): self
38
{
39
if
($sectionModel->
getType
() !==
''
)
40
{
41
$model =
self::createFromXmlId
($sectionModel->
getType
());
42
}
43
else
44
{
45
$model =
self::createNew
();
46
}
47
48
return
$model;
49
}
50
51
public
function
getId
(): int
52
{
53
return
$this->id;
54
}
55
56
public
function
setXmlId
(
string
$xmlId): self
57
{
58
$this->xmlId = $xmlId;
59
return
$this;
60
}
61
62
public
function
getXmlId
(): string
63
{
64
return
$this->xmlId;
65
}
66
}
Bitrix\Calendar\Access\Model\SectionModel
Definition
sectionmodel.php:9
Bitrix\Calendar\Access\Model\SectionModel\getType
getType()
Definition
sectionmodel.php:112
Bitrix\Calendar\Access\Model\TypeModel
Definition
typemodel.php:9
Bitrix\Calendar\Access\Model\TypeModel\createNew
static createNew()
Definition
typemodel.php:32
Bitrix\Calendar\Access\Model\TypeModel\createFromXmlId
static createFromXmlId(string $xmlId)
Definition
typemodel.php:20
Bitrix\Calendar\Access\Model\TypeModel\getId
getId()
Definition
typemodel.php:51
Bitrix\Calendar\Access\Model\TypeModel\createFromSectionModel
static createFromSectionModel(SectionModel $sectionModel)
Definition
typemodel.php:37
Bitrix\Calendar\Access\Model\TypeModel\createFromId
static createFromId(int $itemId=0)
Definition
typemodel.php:15
Bitrix\Calendar\Access\Model\TypeModel\setXmlId
setXmlId(string $xmlId)
Definition
typemodel.php:56
Bitrix\Calendar\Access\Model\TypeModel\getXmlId
getXmlId()
Definition
typemodel.php:62
Bitrix\Calendar\Access\AccessibleType
Definition
accessibletype.php:10
Bitrix\Main\Access\AccessibleItem
Definition
accessibleitem.php:13
Bitrix\Calendar\Access\Model
Definition
eventmodel.php:3
modules
calendar
lib
access
model
typemodel.php
Создано системой
1.10.0