- Модуль: calendar
- Путь к файлу: ~/bitrix/modules/calendar/lib/sync/managers/incomingmanager.php
- Класс: BitrixCalendarSyncManagersIncomingManager
- Вызов: IncomingManager::saveSection
private function saveSection(Section $section): ?Section
{
if ($this->connection->getOwner() === null)
{
throw new CoreBaseBaseException('The connection must have an owner');
}
$fields = [
'NAME' => $section->getName(),
'ACTIVE' => 'Y',
'DESCRIPTION' => $section->getDescription() ?? '',
'COLOR' => $section->getColor() ?? '',
'CAL_TYPE' => $this->connection->getOwner()->getType(),
'OWNER_ID' => $this->connection->getOwner()->getId(),
'CREATED_BY' => $this->connection->getOwner()->getId(),
'DATE_CREATE' => new DateTime(),
'TIMESTAMP_X' => new DateTime(),
'EXTERNAL_TYPE' => $this->connection->getVendor()->getCode(),
];
$sectionId = CCalendar::SaveSection([
'arFields' => $fields,
'originalFrom' => $this->connection->getVendor()->getCode(),
]);
if ($sectionId)
{
return $this->mapperFactory->getSection()
->resetCacheById($sectionId)
->getById($sectionId)
;
}
return null;
}