blob: 62da8796673e20ec129e889d99c00103cdcdd215 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<?php
namespace Civi\Api4\Generic;
use Civi\Api4\Generic\Result;
/**
* Update one or more records with new values.
*
* Use the where clause (required) to select them.
*/
class DAOUpdateAction extends AbstractUpdateAction {
use Traits\DAOActionTrait;
/**
* @inheritDoc
*/
public function _run(Result $result) {
if (!empty($this->values['id'])) {
throw new \Exception("Cannot update the id of an existing " . $this->getEntityName() . '.');
}
$items = $this->getObjects();
foreach ($items as &$item) {
$item = $this->values + $item;
}
$result->exchangeArray($this->writeObjects($items));
}
}
|