mirror of
https://codeberg.org/artfulrobot/contactcats.git
synced 2025-06-26 17:37:18 +02:00
update tests, fix stuff, implement bespoke save, create actions for contactcategory
This commit is contained in:
parent
78e5b83c1d
commit
2ae781f6e3
6 changed files with 273 additions and 29 deletions
28
Civi/Api4/Action/ContactCategory/Create.php
Normal file
28
Civi/Api4/Action/ContactCategory/Create.php
Normal 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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue