4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
10 +--------------------------------------------------------------------+
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
20 namespace Civi\Api4\Action\Entity
;
22 use Civi\Api4\Utils\CoreUtil
;
25 * Get a list of FK links between entities
27 class GetLinks
extends \Civi\Api4\Generic\BasicGetAction
{
29 public function getRecords() {
31 /** @var \Civi\Api4\Service\Schema\SchemaMap $schema */
32 $schema = \Civi
::container()->get('schema_map');
33 foreach ($schema->getTables() as $table) {
34 $entity = CoreUtil
::getApiNameFromTableName($table->getName());
35 // Since this is an api function, exclude tables that don't have an api
36 if (strpos($entity, 'Custom_') === 0 ||
class_exists('\Civi\Api4\\' . $entity)) {
39 'table' => $table->getName(),
42 foreach ($table->getTableLinks() as $link) {
43 $item['links'][] = $link->toArray();
51 public function fields() {
61 'data_type' => 'Array',