* @copyright CiviCRM LLC https://civicrm.org/licensing
*/
+use Civi\Api4\Membership;
+
/**
* Class for member form task actions.
* FIXME: This needs refactoring to properly inherit from CRM_Core_Form_Task and share more functions.
);
}
+ /**
+ * @return array
+ */
+ protected function getIDS() {
+ return $this->_memberIds;
+ }
+
+ /**
+ * Get the rows form the search, keyed to make the token processor happy.
+ *
+ * @throws \API_Exception
+ */
+ protected function getRows(): array {
+ if (empty($this->rows)) {
+ // checkPermissions set to false - in case form is bypassing in some way.
+ $memberships = Membership::get(FALSE)
+ ->addWhere('id', 'IN', $this->getIDs())
+ ->setSelect(['id', 'contact_id'])->execute();
+ foreach ($memberships as $membership) {
+ $this->rows[] = [
+ 'contact_id' => $membership['contact_id'],
+ 'membership_id' => $membership['id'],
+ 'schema' => [
+ 'contactId' => $membership['contact_id'],
+ 'membershipId' => $membership['id'],
+ ],
+ ];
+ }
+ }
+ return $this->rows;
+ }
+
/**
* Get the token processor schema required to list any tokens for this task.
*