Skip to content
Snippets Groups Projects
Commit f004c826 authored by colemanw's avatar colemanw
Browse files

REF - Fix loop in APIv4 Entity.get to only load ad-hoc entities once

parent 2c9ff90b
No related branches found
No related tags found
No related merge requests found
......@@ -40,15 +40,15 @@ class Get extends \Civi\Api4\Generic\BasicGetAction {
$entities = $cache->get('api4.entities.info', []);
if (!$entities) {
// Load entities declared in API files
foreach ($this->getAllApiClasses() as $className) {
// Load entities declared in API files
$this->loadEntity($className, $entities);
// Load entities based on custom data
$entities = array_merge($entities, $this->getCustomEntities());
// Allow extensions to modify the list of entities
$event = GenericHookEvent::create(['entities' => &$entities]);
\Civi::dispatcher()->dispatch('civi.api4.entityTypes', $event);
}
// Load entities based on custom data
$entities = array_merge($entities, $this->getCustomEntities());
// Allow extensions to modify the list of entities
$event = GenericHookEvent::create(['entities' => &$entities]);
\Civi::dispatcher()->dispatch('civi.api4.entityTypes', $event);
ksort($entities);
$cache->set('api4.entities.info', $entities);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment