Метод saveSchedules
Сигнатура метода
private function saveSchedules(int $templateId, array $scheduleTriggers, array $templateConstants, array $existingSchedules): void
Возвращает:
void
Описание
Stores the schedules of the template and, when the template is a managed system AI agent copy, registers every stored row as a resource of its instance in one transaction: a schedule that outlived its instance would keep starting workflows, so either all of the stored rows appear together with their ownership or none of them does. The rows the template no longer describes are removed by the caller before this transaction is opened and are not brought back by its rollback. That is deliberate: a schedule that is gone starts nothing and endangers no invariant, while a restored one would keep starting workflows of a copy whose removal has already begun - which is exactly what the transaction is here to prevent. The rows are built before anything is taken, so a template that stores nothing - because it describes no schedule at all, or because none of its triggers describes one - opens neither the transaction nor the lock. The logical lock of a managed copy is taken before that transaction is opened, so that the whole batch is stored and registered under one lock instead of asking for it again on every row. It is not a promise that no row lock is held while the lock is awaited: the production path runs inside the transaction of the caller of the ORM events of a template, which may hold row locks of its own by then. For a template that is not managed there is nothing to lock and the registration is an immediate no-op.
Параметры
4| Имя | Тип | По умолчанию | Флаги |
|---|---|---|---|
$templateId
|
int
|
—
|
—
|
$scheduleTriggers
|
array
|
—
|
—
|
$templateConstants
|
array
|
—
|
—
|
$existingSchedules
|
array
|
—
|
—
|
Расположение
Исходный файл метода в Bitrix Framework
~/bitrix/modulesbizproc/lib/Internal/Service/Trigger/Schedule/ScheduleSyncService.php