Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
instancemap.php
1
<?php
2
3
namespace
Bitrix\Calendar\Sync\Entities
;
4
5
use
Bitrix\Calendar\Core\Base\Date
;
6
use
Bitrix\Calendar\Core\Base\Map
;
7
8
class
InstanceMap
extends
Map
9
{
10
public
const
DATE_FORMAT_FOR_KEY
=
'Ymd'
;
11
16
public
static
function
getKeyByDate
(
Date
$originalDate): string
17
{
18
return
$originalDate->
format
(self::DATE_FORMAT_FOR_KEY);
19
}
20
27
public
function
add
($item, $key =
null
): self
28
{
30
if
($key ===
null
)
31
{
32
if
($date = $item->getEvent()->getOriginalDateFrom())
33
{
34
$key =
self::getKeyByDate
($date);
35
}
36
else
37
{
38
$key =
self::getKeyByDate
($item->getEvent()->getStart());
39
}
40
}
41
42
parent::add($item, $key);
43
44
return
$this;
45
}
46
50
public
function
addItems
(array $items): self
51
{
52
foreach
($items as $item)
53
{
54
$this->
add
($item);
55
}
56
57
return
$this;
58
}
59
}
Bitrix\Calendar\Core\Base\Date
Definition
date.php:10
Bitrix\Calendar\Core\Base\Date\format
format(string $format=null)
Definition
date.php:107
Bitrix\Calendar\Core\Base\Map
Definition
map.php:11
Bitrix\Calendar\Core\Base\Map\add
add($item, $key=null)
Definition
map.php:20
Bitrix\Calendar\Sync\Entities\InstanceMap
Definition
instancemap.php:9
Bitrix\Calendar\Sync\Entities\InstanceMap\DATE_FORMAT_FOR_KEY
const DATE_FORMAT_FOR_KEY
Definition
instancemap.php:10
Bitrix\Calendar\Sync\Entities\InstanceMap\addItems
addItems(array $items)
Definition
instancemap.php:50
Bitrix\Calendar\Sync\Entities\InstanceMap\getKeyByDate
static getKeyByDate(Date $originalDate)
Definition
instancemap.php:16
Bitrix\Calendar\Sync\Entities
Definition
instancecollection.php:3
modules
calendar
lib
sync
entities
instancemap.php
Создано системой
1.10.0