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 `Update` api actions
25 * @method $this setValues(array $values) Set all field values from an array of key => value pairs.
26 * @method array getValues() Get field values.
27 * @method $this setReload(bool $reload) Specify whether complete objects will be returned after saving.
28 * @method bool getReload()
30 * @package Civi\Api4\Generic
32 abstract class AbstractUpdateAction
extends AbstractBatchAction
{
35 * Field values to update.
40 protected $values = [];
43 * Reload $ENTITIES after saving.
45 * Setting to `true` will load complete records and return them as the api result.
46 * If `false` the api usually returns only the fields specified to be updated.
50 protected $reload = FALSE;
53 * @param string $fieldName
57 public function getValue(string $fieldName) {
58 return $this->values
[$fieldName] ??
NULL;
62 * Add an item to the values array.
64 * @param string $fieldName
68 public function addValue(string $fieldName, $value) {
69 $this->values
[$fieldName] = $value;