get('schema_map'); foreach ($schema->getTables() as $table) { $entity = CoreUtil::getApiNameFromTableName($table->getName()); // Since this is an api function, exclude tables that don't have an api if (strpos($entity, 'Custom_') === 0 || class_exists('\Civi\Api4\\' . $entity)) { $item = [ 'entity' => $entity, 'table' => $table->getName(), 'links' => [], ]; foreach ($table->getTableLinks() as $link) { $item['links'][] = $link->toArray(); } $result[] = $item; } } return $result; } public function fields() { return [ [ 'name' => 'entity', ], [ 'name' => 'table', ], [ 'name' => 'links', 'data_type' => 'Array', ], ]; } }