4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
10 +--------------------------------------------------------------------+
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
22 namespace Civi\Api4\Generic
;
25 * Base class for all batch actions (Update, Delete, Replace).
27 * This differs from the AbstractQuery class in that the "Where" clause is required.
29 * @package Civi\Api4\Generic
31 abstract class AbstractBatchAction
extends AbstractQueryAction
{
34 * Criteria for selecting items to process.
39 protected $where = [];
47 * BatchAction constructor.
48 * @param string $entityName
49 * @param string $actionName
50 * @param string|array $select
51 * One or more fields to load for each item.
53 public function __construct($entityName, $actionName, $select = 'id') {
54 $this->select
= (array) $select;
55 parent
::__construct($entityName, $actionName);
61 protected function getBatchRecords() {
63 'checkPermissions' => $this->checkPermissions
,
64 'where' => $this->where
,
65 'orderBy' => $this->orderBy
,
66 'limit' => $this->limit
,
67 'offset' => $this->offset
,
69 if (empty($this->reload
)) {
70 $params['select'] = $this->select
;
73 return (array) civicrm_api4($this->getEntityName(), 'get', $params);
79 protected function getSelect() {