ActionSchedule - Fill TokenProcessor will real batches
authorTim Otten <totten@civicrm.org>
Wed, 11 Aug 2021 00:52:13 +0000 (17:52 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 11 Aug 2021 01:57:05 +0000 (18:57 -0700)
commitc06f174feaa0e82fac89c3709e6fe0ca36f3b9b4
treee2660324af83e9c666712393eb0b59f6a0c5e9e6
parent39eb69ec7d483b7d10abffb6ebd679d66d6b8446
ActionSchedule - Fill TokenProcessor will real batches

Background: `ActionSchedule::sendMailings()` fetches a batch of pending reminders (per
some specific schedule/rule). Then it composes and sends a message for each.

Before: For each item in the batch, it makes a new `TokenProcessor`.  This
means that the `TokenProcessor` only sees one pending reminder. Therefore, the
`TokenProcessor` cannot meaningfully fetch batched data.

After: It creates one `TokenProcessor` and adds rows for each pending
reminder.  This means that `TokenProcessor` can fetch batched data.# On
branch master-action-batch

Comments: This part of a longer plot to simplify the `CRM_*_Tokens`.
Currently, `CRM_*_Tokens` implements duplicate prefetch mechanisms -- the
general-purpose `prefetch()` and the special-purpose
`alterActionScheduleQuery()`.  This patch makes it possible to use
`prefetch()` for all the real work of prefetching (and phasing-out
`alterActionScheduleQuery()`).
CRM/Core/BAO/ActionSchedule.php
Civi/Token/TokenProcessor.php