Метод mergeAndSlice
Расположение
Исходный файл метода в Bitrix Framework
~/bitrix/modulesim/lib/V2/Sync/SyncService.php
Исходный код
Сигнатура метода
private function mergeAndSlice(array $rowsUser, array $rowsGlobal, int $limit, int &$mergedCount): array
Возвращает:
array
Описание
ALG-01: merge both sources, sort by (DATE_CREATE, ID), cut to $limit. Cursor must come from the LAST row of the slice (not the max of all fetched), else rows between the slice boundary and the max are skipped next page. $mergedCount = total before slicing (for exact hasMore). Both $rowsUser and $rowsGlobal arrive pre-sorted by (DATE_CREATE ASC, ID ASC) from fetchRowsByUserId, so a linear 2-way merge suffices — O(n) time and zero extra allocations vs the prior array_merge + usort approach O(n log n). The resulting order is identical to the old usort comparator.
Параметры
4| Имя | Тип | По умолчанию | Флаги |
|---|---|---|---|
$rowsUser
|
array
|
-
|
-
|
$rowsGlobal
|
array
|
-
|
-
|
$limit
|
int
|
-
|
-
|
$mergedCount
|
int
|
-
|
|