Skip to content
Snippets Groups Projects
Commit b424aff9 authored by Rich Lott / Artful Robot's avatar Rich Lott / Artful Robot
Browse files

Add updateBundle param for Inlay.update so you can optionally skip updating bundle (updater)

parent defb2046
Branches master
No related tags found
No related merge requests found
......@@ -5,6 +5,16 @@ use Civi\Api4\Generic\Result;
trait WriteTrait {
/**
* Whether to rebuild the bundle on save. Normally you want this,
* but in upgrader scripts it can cause trouble.
*
* @var bool
*
* @default true
*/
protected $updateBundle = TRUE;
/**
* Override the formatWriteValues.
*
......@@ -27,13 +37,14 @@ trait WriteTrait {
* @param Result $result
*/
public function updateBundle(Result $result) {
$updatedInlayIDs = $result->column('id');
if ($updatedInlayIDs) {
\Civi\Api4\Inlay::createBundle(FALSE)
->setCheckPermissions(FALSE)
->addWhere('id', 'IN', $updatedInlayIDs)
->execute();
if ($this->updateBundle) {
$updatedInlayIDs = $result->column('id');
if ($updatedInlayIDs) {
\Civi\Api4\Inlay::createBundle(FALSE)
->setCheckPermissions(FALSE)
->addWhere('id', 'IN', $updatedInlayIDs)
->execute();
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment