blob: 628bc6faa4e6c9a4eed9c0a892640e62bc0e1717 (
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
|
<?php
namespace Civi\Api4\Utils;
class ActionUtil {
/**
* @param $entityName
* @param $actionName
* @return \Civi\Api4\Generic\AbstractAction
* @throws \Civi\API\Exception\NotImplementedException
*/
public static function getAction($entityName, $actionName) {
// For custom pseudo-entities
if (strpos($entityName, 'Custom_') === 0) {
return \Civi\Api4\CustomValue::$actionName(substr($entityName, 7));
}
else {
$callable = ["\\Civi\\Api4\\$entityName", $actionName];
if (!is_callable($callable)) {
throw new \Civi\API\Exception\NotImplementedException("API ($entityName, $actionName) does not exist (join the API team and implement it!)");
}
return call_user_func($callable);
}
}
}
|