- Модуль: calendar
- Путь к файлу: ~/bitrix/modules/calendar/lib/sync/managers/pushmanager.php
- Класс: BitrixCalendarSyncManagersPushManager
- Вызов: PushManager::syncSection
private function syncSection(Push $push): void
{
/** @var SyncConnectionSectionConnection $sectionLink
*/
$sectionLink = (new SectionConnection())->getById($push->getEntityId());
if ($sectionLink)
{
try
{
if (!$this->lockConnection($sectionLink->getConnection(), self::LOCK_CONNECTION_TIME))
{
$this->pushSectionToQueue($sectionLink);
return;
}
$syncSectionMap = new SyncSectionMap();
$syncSection = (new SyncSection())
->setSection($sectionLink->getSection())
->setSectionConnection($sectionLink)
->setVendorName($sectionLink->getConnection()->getVendor()->getCode());
$syncSectionMap->add(
$syncSection,
$syncSection->getSectionConnection()->getVendorSectionId()
);
$factory = FactoryBuilder::create(
$sectionLink->getConnection()->getVendor()->getCode(),
$sectionLink->getConnection(),
new SyncUtilContext()
);
$manager = new VendorDataExchangeManager($factory, $syncSectionMap);
$manager
->importEvents()
->updateConnection($sectionLink->getConnection());
$this->markPushSuccess($push, true);
}
catch(BaseException $e)
{
$this->markPushSuccess($push, false);
}
finally
{
$this->unLockConnection($sectionLink->getConnection());
}
}
else
{
$this->deletePush($push);
}
}