22 private $mapperFactory;
25 $this->mapperFactory = ServiceLocator::getInstance()->get(
'calendar.service.mappers.factory');
40 $statement = SectionConnectionTable::query()->setSelect([
'*']);
41 if (!empty($params[
'filter']))
43 $statement->setFilter($params[
'filter']);
45 if ($link = $statement->fetchObject())
48 return $this->prepareLink(
50 $params[
'connectionObject'] ??
null,
51 $params[
'sectionObject'] ??
null,
75 $linkData = SectionConnectionTable::query()
77 ->addFilter(
'CONNECTION_ID', $connection->getId())
78 ->addFilter(
'SECTION_ID', $section->getId())
79 ->exec()->fetchObject()
86 return $this->prepareLink($linkData, $connection, $section);
101 $statement = SectionConnectionTable::query();
102 $statement->setSelect([
'*']);
103 $statement->addFilter(
'CONNECTION_ID', $connection->getId());
106 $statement->addFilter(
'=ACTIVE',
'Y');
109 $links = $statement->exec();
111 while ($link = $links->fetchObject())
113 $result[] = $this->prepareLink($link, $connection);
131 private function prepareLink(
132 EO_SectionConnection $link,
137 if ($connection ===
null)
139 $connection = $this->mapperFactory->getConnection()->
getById($link->getConnectionId());
142 ?? ($link->getSection()
143 ? $this->buildSection($link->getSection())
146 if ($section ===
null)
148 $section = $this->mapperFactory->getSection()->getById($link->getSectionId());
157 $item =
new SectionConnection();
159 ->setId($link->getId())
160 ->setSection($section)
161 ->setConnection($connection)
162 ->setVendorSectionId($link->getVendorSectionId())
163 ->setSyncToken($link->getSyncToken())
164 ->setPageToken($link->getPageToken())
165 ->setActive($link->getActive())
166 ->setLastSyncDate(
new Core\Base\Date($link->getLastSyncDate()))
167 ->setLastSyncStatus($link->getLastSyncStatus())
168 ->setVersionId($link->get(
'VERSION_ID'))
179 private function buildSection(EO_Section $EOSection): Section
181 return (
new SectionBuilderFromDataManager($EOSection))->build();