* @throws \CRM_Core_Exception
*/
public function getEntitiesHitech(): array {
- // Ensure all components are enabled so their entities show up
- foreach (array_keys(\CRM_Core_Component::getComponents()) as $component) {
- \CRM_Core_BAO_ConfigSetting::enableComponent($component);
- }
return $this->toDataProviderArray(Entity::get(FALSE)->execute()->column('name'));
}
* @return array
*/
public function getEntitiesLotech(): array {
- // TODO: Auto-scan required core extensions like search_kit
- $manual['add'] = ['SearchDisplay', 'SearchSegment'];
- $manual['remove'] = ['CustomValue'];
+ // Core + required core extensions
+ $directores = ['', 'ext/search_kit/', 'ext/civi_*/'];
+ $manual['remove'] = ['CustomValue', 'SKEntity'];
$manual['transform'] = ['CiviCase' => 'Case'];
$scanned = [];
- $srcDir = dirname(__DIR__, 5);
- foreach ((array) glob("$srcDir/Civi/Api4/*.php") as $name) {
- $fileName = basename($name, '.php');
- $scanned[] = $manual['transform'][$fileName] ?? $fileName;
+ $baseDir = dirname(__DIR__, 5);
+ foreach ($directores as $directory) {
+ foreach ((array) glob("$baseDir/{$directory}Civi/Api4/*.php") as $name) {
+ $fileName = basename($name, '.php');
+ $scanned[] = $manual['transform'][$fileName] ?? $fileName;
+ }
}
$names = array_diff(
- array_unique(array_merge($scanned, $manual['add'])),
+ $scanned,
$manual['remove']
);
namespace api\v4\Entity;
-use Civi\API\Exception\NotImplementedException;
use Civi\Api4\Entity;
use api\v4\Api4TestBase;
$this->assertArrayNotHasKey('Participant', $result,
"Entity::get should not have Participant when CiviEvent disabled");
- // Trying to use a CiviEvent API will fail when component is disabled
- try {
- \Civi\Api4\Participant::get(FALSE)->execute();
- $this->fail();
- }
- catch (NotImplementedException $e) {
- $this->assertStringContainsString('CiviEvent', $e->getMessage());
- }
-
\CRM_Core_BAO_ConfigSetting::enableComponent('CiviEvent');
$result = Entity::get(FALSE)
->execute()