update tests, fix stuff, implement bespoke save, create actions for contactcategory

This commit is contained in:
Rich Lott / Artful Robot 2025-03-26 10:13:00 +00:00
parent 78e5b83c1d
commit 2ae781f6e3
6 changed files with 273 additions and 29 deletions

View file

@ -0,0 +1,28 @@
<?php
namespace Civi\Api4\Action\ContactCategory;
use Civi\Api4\Generic\Result;
use Civi\Api4\ContactCategory;
use CRM_Contactcats_ExtensionUtil as E;
/**
* Create ContactCategory action
*
* This entity's ID is a unique primary key that references
* contact_id. Here we overwrite the validateValues which normally
*
*/
class Create extends \Civi\Api4\Generic\DAOCreateAction {
/**
* @inheritDoc
*/
public function _run(Result $result) {
// Wrap Save API
$saveResults = ContactCategory::save($this->getCheckPermissions())
->addRecord($this->values)
->execute()->getArrayCopy();
$result->exchangeArray($saveResults);
}
}