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
20 namespace Civi\Api4\Generic
;
23 * Base class for all batch actions (Update, Delete, Replace).
25 * This differs from the AbstractQuery class in that the "Where" clause is required.
27 * @package Civi\Api4\Generic
29 abstract class AbstractBatchAction
extends AbstractQueryAction
{
32 * Criteria for selecting $ENTITIES to process.
37 protected $where = [];
45 * BatchAction constructor.
46 * @param string $entityName
47 * @param string $actionName
48 * @param string|array $select
49 * One or more fields to load for each item.
51 public function __construct($entityName, $actionName, $select = 'id') {
52 $this->select
= (array) $select;
53 parent
::__construct($entityName, $actionName);
59 protected function getBatchRecords() {
61 'checkPermissions' => $this->checkPermissions
,
62 'where' => $this->where
,
63 'orderBy' => $this->orderBy
,
64 'limit' => $this->limit
,
65 'offset' => $this->offset
,
67 if (empty($this->reload
)) {
68 $params['select'] = $this->select
;
71 return (array) civicrm_api4($this->getEntityName(), 'get', $params);
77 protected function getSelect() {