Core_DAO - fire links_callback for all entities even if they don't explicitly declare...
authorColeman Watts <coleman@civicrm.org>
Mon, 17 May 2021 22:12:30 +0000 (18:12 -0400)
committerColeman Watts <coleman@civicrm.org>
Mon, 17 May 2021 22:13:30 +0000 (18:13 -0400)
CRM_Core_DAO has a fallback function for entities with no foreign key fields.
Previously, that function did not call createReferenceColumns or fire links_callback

CRM/Core/DAO.php

index 0e901cdc4235fe6b01bf734110af07f40a2efbcf..c8b69996635ab6609b9cc0f6b2d0d5b9cba4e937 100644 (file)
@@ -526,11 +526,14 @@ class CRM_Core_DAO extends DB_DataObject {
   /**
    * Returns list of FK relationships.
    *
-   *
    * @return CRM_Core_Reference_Basic[]
    */
   public static function getReferenceColumns() {
-    return [];
+    if (!isset(Civi::$statics[static::class]['links'])) {
+      Civi::$statics[static::class]['links'] = static::createReferenceColumns(static::class);
+      CRM_Core_DAO_AllCoreTables::invoke(static::class, 'links_callback', Civi::$statics[static::class]['links']);
+    }
+    return Civi::$statics[static::class]['links'];
   }
 
   /**