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