Rename RelationshipVortex to RelationshipCache
authorTim Otten <totten@civicrm.org>
Thu, 16 Jul 2020 07:21:58 +0000 (00:21 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 16 Jul 2020 22:21:09 +0000 (15:21 -0700)
CRM/Contact/BAO/RelationshipCache.php [moved from CRM/Contact/BAO/RelationshipVortex.php with 88% similarity]
CRM/Contact/DAO/RelationshipCache.php [moved from CRM/Contact/DAO/RelationshipVortex.php with 72% similarity]
CRM/Core/DAO/AllCoreTables.data.php
CRM/Upgrade/Incremental/php/FiveTwentyNine.php
CRM/Upgrade/Incremental/sql/5.29.alpha1.mysql.tpl
Civi/Core/Container.php
tests/phpunit/CRM/Contact/BAO/RelationshipCacheTest.php [moved from tests/phpunit/CRM/Contact/BAO/RelationshipVortexTest.php with 83% similarity]
tests/phpunit/CRM/Dedupe/MergerTest.php
xml/schema/Contact/RelationshipCache.xml [moved from xml/schema/Contact/RelationshipVortex.xml with 83% similarity]
xml/schema/Contact/files.xml

similarity index 88%
rename from CRM/Contact/BAO/RelationshipVortex.php
rename to CRM/Contact/BAO/RelationshipCache.php
index fe6f889c248c53116928d09350b470753c63d7a3..686fc0a351863dcab6f54499b791dc7bb2705050 100644 (file)
  */
 
 /**
- * Class CRM_Contact_BAO_RelationshipVortex.
+ * Class CRM_Contact_BAO_RelationshipCache.
  */
-class CRM_Contact_BAO_RelationshipVortex extends CRM_Contact_DAO_RelationshipVortex {
+class CRM_Contact_BAO_RelationshipCache extends CRM_Contact_DAO_RelationshipCache {
 
   /**
-   * The "mappings" array defines the values to put into `civicrm_relationship_vtx`
+   * The "mappings" array defines the values to put into `civicrm_relationship_cache`
    * using data from `civicrm_relationship rel` and `civicrm_relationship_type reltype`.
    *
    * @var array
@@ -59,7 +59,7 @@ class CRM_Contact_BAO_RelationshipVortex extends CRM_Contact_DAO_RelationshipVor
 
   /**
    * A list of of fields in `civicrm_relationship_type` which (if changed)
-   * will necessitate an update to the vortex.
+   * will necessitate an update to the cache.
    *
    * @var array
    */
@@ -78,7 +78,7 @@ class CRM_Contact_BAO_RelationshipVortex extends CRM_Contact_DAO_RelationshipVor
        * This trigger runs whenever a "civicrm_relationship" record is inserted or updated.
        *
        * Goal: Ensure that every relationship record has two corresponding entries in the
-       * vortex, the forward relationship (A=>B) and reverse relationship (B=>A).
+       * cache, the forward relationship (A=>B) and reverse relationship (B=>A).
        */
       $triggers[] = [
         'table' => 'civicrm_relationship',
@@ -109,27 +109,27 @@ class CRM_Contact_BAO_RelationshipVortex extends CRM_Contact_DAO_RelationshipVor
       ];
     }
 
-    // Note: We do not need a DELETE trigger to maintain `civicrm_relationship_vtx` because it uses `<onDelete>CASCADE</onDelete>`.
+    // Note: We do not need a DELETE trigger to maintain `civicrm_relationship_cache` because it uses `<onDelete>CASCADE</onDelete>`.
 
     $st = new \Civi\Core\SqlTrigger\StaticTriggers($triggers);
     $st->onTriggerInfo($e);
   }
 
   /**
-   * Read all records from civicrm_relationship and populate the vortex.
+   * Read all records from civicrm_relationship and populate the cache.
    * Each ordinary relationship in `civicrm_relationship` becomes two
-   * distinct records in the vortex (one for A=>B relations; and one for B=>A).
+   * distinct records in the cache (one for A=>B relations; and one for B=>A).
    *
    * This method is primarily written (a) for manual testing and (b) in case
    * a broken DBMS, screwy import, buggy code, etc causes a corruption.
    *
-   * NOTE: This is closely related to FiveTwentyNine::populateRelationshipVortex(),
+   * NOTE: This is closely related to FiveTwentyNine::populateRelationshipCache(),
    * except that the upgrader users pagination.
    */
   public static function rebuild() {
     $relUpdates = self::createInsertUpdateQueries();
 
-    CRM_Core_DAO::executeQuery('TRUNCATE civicrm_relationship_vtx');
+    CRM_Core_DAO::executeQuery('TRUNCATE civicrm_relationship_cache');
     foreach ($relUpdates as $relUpdate) {
       $relUpdate->execute();
     }
@@ -137,7 +137,7 @@ class CRM_Contact_BAO_RelationshipVortex extends CRM_Contact_DAO_RelationshipVor
 
   /**
    * Prepare a list of SQL queries that map data from civicrm_relationship
-   * to civicrm_relationship_vtx.
+   * to civicrm_relationship_cache.
    *
    * @return CRM_Utils_SQL_Select[]
    *   A list of SQL queries - one for each mapping.
@@ -147,7 +147,7 @@ class CRM_Contact_BAO_RelationshipVortex extends CRM_Contact_DAO_RelationshipVor
     foreach (self::$mappings as $name => $mapping) {
       $queries[$name] = CRM_Utils_SQL_Select::from('civicrm_relationship rel')
         ->join('reltype', 'INNER JOIN civicrm_relationship_type reltype ON rel.relationship_type_id = reltype.id')
-        ->syncInto('civicrm_relationship_vtx', self::$keyFields, $mapping);
+        ->syncInto('civicrm_relationship_cache', self::$keyFields, $mapping);
     }
     return $queries;
   }
similarity index 72%
rename from CRM/Contact/DAO/RelationshipVortex.php
rename to CRM/Contact/DAO/RelationshipCache.php
index b20ff0046580bda9b479395c10418d0c94d0b872..f79fd1ee67f53dbedf61292927dac616b413a675 100644 (file)
@@ -4,22 +4,22 @@
  * @package CRM
  * @copyright CiviCRM LLC https://civicrm.org/licensing
  *
- * Generated from xml/schema/CRM/Contact/RelationshipVortex.xml
+ * Generated from xml/schema/CRM/Contact/RelationshipCache.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:01ed7a8f57a4438462decea08a76138a)
+ * (GenCodeChecksum:082fd4d2b313bc1928f56da80a620582)
  */
 
 /**
- * Database access object for the RelationshipVortex entity.
+ * Database access object for the RelationshipCache entity.
  */
-class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
+class CRM_Contact_DAO_RelationshipCache extends CRM_Core_DAO {
 
   /**
    * Static instance to hold the table name.
    *
    * @var string
    */
-  public static $_tableName = 'civicrm_relationship_vtx';
+  public static $_tableName = 'civicrm_relationship_cache';
 
   /**
    * Icon associated with this entity.
@@ -36,7 +36,7 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
   public static $_log = FALSE;
 
   /**
-   * Relationship Vortex ID
+   * Relationship Cache ID
    *
    * @var int
    */
@@ -57,7 +57,7 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
   public $relationship_type_id;
 
   /**
-   * The vortex record is a permutation of the original relationship record. The orientation indicates whether it is forward (a_b) or reverse (b_a) relationship.
+   * The cache record is a permutation of the original relationship record. The orientation indicates whether it is forward (a_b) or reverse (b_a) relationship.
    *
    * @var string
    */
@@ -123,7 +123,7 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
    * Class constructor.
    */
   public function __construct() {
-    $this->__table = 'civicrm_relationship_vtx';
+    $this->__table = 'civicrm_relationship_cache';
     parent::__construct();
   }
 
@@ -131,7 +131,7 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
    * Returns localized title of this entity.
    */
   public static function getEntityTitle() {
-    return ts('Relationship Vortexes');
+    return ts('Relationship Caches');
   }
 
   /**
@@ -164,13 +164,13 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
         'id' => [
           'name' => 'id',
           'type' => CRM_Utils_Type::T_INT,
-          'title' => ts('Relationship Vortex ID'),
-          'description' => ts('Relationship Vortex ID'),
+          'title' => ts('Relationship Cache ID'),
+          'description' => ts('Relationship Cache ID'),
           'required' => TRUE,
-          'where' => 'civicrm_relationship_vtx.id',
-          'table_name' => 'civicrm_relationship_vtx',
-          'entity' => 'RelationshipVortex',
-          'bao' => 'CRM_Contact_BAO_RelationshipVortex',
+          'where' => 'civicrm_relationship_cache.id',
+          'table_name' => 'civicrm_relationship_cache',
+          'entity' => 'RelationshipCache',
+          'bao' => 'CRM_Contact_BAO_RelationshipCache',
           'localizable' => 0,
           'add' => '5.29',
         ],
@@ -180,10 +180,10 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
           'title' => ts('Relationship'),
           'description' => ts('id of the relationship (FK to civicrm_relationship.id)'),
           'required' => TRUE,
-          'where' => 'civicrm_relationship_vtx.relationship_id',
-          'table_name' => 'civicrm_relationship_vtx',
-          'entity' => 'RelationshipVortex',
-          'bao' => 'CRM_Contact_BAO_RelationshipVortex',
+          'where' => 'civicrm_relationship_cache.relationship_id',
+          'table_name' => 'civicrm_relationship_cache',
+          'entity' => 'RelationshipCache',
+          'bao' => 'CRM_Contact_BAO_RelationshipCache',
           'localizable' => 0,
           'FKClassName' => 'CRM_Contact_DAO_Relationship',
           'add' => '5.29',
@@ -194,10 +194,10 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
           'title' => ts('Relationship Type'),
           'description' => ts('id of the relationship type'),
           'required' => TRUE,
-          'where' => 'civicrm_relationship_vtx.relationship_type_id',
-          'table_name' => 'civicrm_relationship_vtx',
-          'entity' => 'RelationshipVortex',
-          'bao' => 'CRM_Contact_BAO_RelationshipVortex',
+          'where' => 'civicrm_relationship_cache.relationship_type_id',
+          'table_name' => 'civicrm_relationship_cache',
+          'entity' => 'RelationshipCache',
+          'bao' => 'CRM_Contact_BAO_RelationshipCache',
           'localizable' => 0,
           'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
           'add' => '5.29',
@@ -206,14 +206,14 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
           'name' => 'orientation',
           'type' => CRM_Utils_Type::T_STRING,
           'title' => ts('Orientation (a_b or b_a)'),
-          'description' => ts('The vortex record is a permutation of the original relationship record. The orientation indicates whether it is forward (a_b) or reverse (b_a) relationship.'),
+          'description' => ts('The cache record is a permutation of the original relationship record. The orientation indicates whether it is forward (a_b) or reverse (b_a) relationship.'),
           'required' => TRUE,
           'maxlength' => 3,
           'size' => CRM_Utils_Type::FOUR,
-          'where' => 'civicrm_relationship_vtx.orientation',
-          'table_name' => 'civicrm_relationship_vtx',
-          'entity' => 'RelationshipVortex',
-          'bao' => 'CRM_Contact_BAO_RelationshipVortex',
+          'where' => 'civicrm_relationship_cache.orientation',
+          'table_name' => 'civicrm_relationship_cache',
+          'entity' => 'RelationshipCache',
+          'bao' => 'CRM_Contact_BAO_RelationshipCache',
           'localizable' => 0,
           'add' => '5.29',
         ],
@@ -223,10 +223,10 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
           'title' => ts('Contact ID (Near side)'),
           'description' => ts('id of the first contact'),
           'required' => TRUE,
-          'where' => 'civicrm_relationship_vtx.near_contact_id',
-          'table_name' => 'civicrm_relationship_vtx',
-          'entity' => 'RelationshipVortex',
-          'bao' => 'CRM_Contact_BAO_RelationshipVortex',
+          'where' => 'civicrm_relationship_cache.near_contact_id',
+          'table_name' => 'civicrm_relationship_cache',
+          'entity' => 'RelationshipCache',
+          'bao' => 'CRM_Contact_BAO_RelationshipCache',
           'localizable' => 0,
           'FKClassName' => 'CRM_Contact_DAO_Contact',
           'add' => '5.29',
@@ -238,10 +238,10 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
           'description' => ts('name for relationship of near_contact to far_contact.'),
           'maxlength' => 64,
           'size' => CRM_Utils_Type::BIG,
-          'where' => 'civicrm_relationship_vtx.near_relation',
-          'table_name' => 'civicrm_relationship_vtx',
-          'entity' => 'RelationshipVortex',
-          'bao' => 'CRM_Contact_BAO_RelationshipVortex',
+          'where' => 'civicrm_relationship_cache.near_relation',
+          'table_name' => 'civicrm_relationship_cache',
+          'entity' => 'RelationshipCache',
+          'bao' => 'CRM_Contact_BAO_RelationshipCache',
           'localizable' => 0,
           'add' => '5.29',
         ],
@@ -251,10 +251,10 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
           'title' => ts('Contact ID (Far side)'),
           'description' => ts('id of the second contact'),
           'required' => TRUE,
-          'where' => 'civicrm_relationship_vtx.far_contact_id',
-          'table_name' => 'civicrm_relationship_vtx',
-          'entity' => 'RelationshipVortex',
-          'bao' => 'CRM_Contact_BAO_RelationshipVortex',
+          'where' => 'civicrm_relationship_cache.far_contact_id',
+          'table_name' => 'civicrm_relationship_cache',
+          'entity' => 'RelationshipCache',
+          'bao' => 'CRM_Contact_BAO_RelationshipCache',
           'localizable' => 0,
           'FKClassName' => 'CRM_Contact_DAO_Contact',
           'html' => [
@@ -269,10 +269,10 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
           'description' => ts('name for relationship of far_contact to near_contact.'),
           'maxlength' => 64,
           'size' => CRM_Utils_Type::BIG,
-          'where' => 'civicrm_relationship_vtx.far_relation',
-          'table_name' => 'civicrm_relationship_vtx',
-          'entity' => 'RelationshipVortex',
-          'bao' => 'CRM_Contact_BAO_RelationshipVortex',
+          'where' => 'civicrm_relationship_cache.far_relation',
+          'table_name' => 'civicrm_relationship_cache',
+          'entity' => 'RelationshipCache',
+          'bao' => 'CRM_Contact_BAO_RelationshipCache',
           'localizable' => 0,
           'add' => '5.29',
         ],
@@ -281,11 +281,11 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_BOOLEAN,
           'title' => ts('Relationship Is Active'),
           'description' => ts('is the relationship active ?'),
-          'where' => 'civicrm_relationship_vtx.is_active',
+          'where' => 'civicrm_relationship_cache.is_active',
           'default' => '1',
-          'table_name' => 'civicrm_relationship_vtx',
-          'entity' => 'RelationshipVortex',
-          'bao' => 'CRM_Contact_BAO_RelationshipVortex',
+          'table_name' => 'civicrm_relationship_cache',
+          'entity' => 'RelationshipCache',
+          'bao' => 'CRM_Contact_BAO_RelationshipCache',
           'localizable' => 0,
           'html' => [
             'type' => 'CheckBox',
@@ -297,10 +297,10 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_DATE,
           'title' => ts('Relationship Start Date'),
           'description' => ts('date when the relationship started'),
-          'where' => 'civicrm_relationship_vtx.start_date',
-          'table_name' => 'civicrm_relationship_vtx',
-          'entity' => 'RelationshipVortex',
-          'bao' => 'CRM_Contact_BAO_RelationshipVortex',
+          'where' => 'civicrm_relationship_cache.start_date',
+          'table_name' => 'civicrm_relationship_cache',
+          'entity' => 'RelationshipCache',
+          'bao' => 'CRM_Contact_BAO_RelationshipCache',
           'localizable' => 0,
           'html' => [
             'type' => 'Select Date',
@@ -313,10 +313,10 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_DATE,
           'title' => ts('Relationship End Date'),
           'description' => ts('date when the relationship ended'),
-          'where' => 'civicrm_relationship_vtx.end_date',
-          'table_name' => 'civicrm_relationship_vtx',
-          'entity' => 'RelationshipVortex',
-          'bao' => 'CRM_Contact_BAO_RelationshipVortex',
+          'where' => 'civicrm_relationship_cache.end_date',
+          'table_name' => 'civicrm_relationship_cache',
+          'entity' => 'RelationshipCache',
+          'bao' => 'CRM_Contact_BAO_RelationshipCache',
           'localizable' => 0,
           'html' => [
             'type' => 'Select Date',
@@ -329,11 +329,11 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_INT,
           'title' => ts('Relationship Case'),
           'description' => ts('FK to civicrm_case'),
-          'where' => 'civicrm_relationship_vtx.case_id',
+          'where' => 'civicrm_relationship_cache.case_id',
           'default' => 'NULL',
-          'table_name' => 'civicrm_relationship_vtx',
-          'entity' => 'RelationshipVortex',
-          'bao' => 'CRM_Contact_BAO_RelationshipVortex',
+          'table_name' => 'civicrm_relationship_cache',
+          'entity' => 'RelationshipCache',
+          'bao' => 'CRM_Contact_BAO_RelationshipCache',
           'localizable' => 0,
           'FKClassName' => 'CRM_Case_DAO_Case',
           'add' => '5.29',
@@ -383,7 +383,7 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
    * @return array
    */
   public static function &import($prefix = FALSE) {
-    $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'relationship_vtx', $prefix, []);
+    $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'relationship_cache', $prefix, []);
     return $r;
   }
 
@@ -395,7 +395,7 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
    * @return array
    */
   public static function &export($prefix = FALSE) {
-    $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'relationship_vtx', $prefix, []);
+    $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'relationship_cache', $prefix, []);
     return $r;
   }
 
@@ -416,7 +416,7 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
         ],
         'localizable' => FALSE,
         'unique' => TRUE,
-        'sig' => 'civicrm_relationship_vtx::1::relationship_id::orientation',
+        'sig' => 'civicrm_relationship_cache::1::relationship_id::orientation',
       ],
       'index_nearid_nearrelation' => [
         'name' => 'index_nearid_nearrelation',
@@ -425,7 +425,7 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
           1 => 'near_relation',
         ],
         'localizable' => FALSE,
-        'sig' => 'civicrm_relationship_vtx::0::near_contact_id::near_relation',
+        'sig' => 'civicrm_relationship_cache::0::near_contact_id::near_relation',
       ],
       'index_nearid_farrelation' => [
         'name' => 'index_nearid_farrelation',
@@ -434,7 +434,7 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
           1 => 'far_relation',
         ],
         'localizable' => FALSE,
-        'sig' => 'civicrm_relationship_vtx::0::near_contact_id::far_relation',
+        'sig' => 'civicrm_relationship_cache::0::near_contact_id::far_relation',
       ],
       'index_near_relation' => [
         'name' => 'index_near_relation',
@@ -442,7 +442,7 @@ class CRM_Contact_DAO_RelationshipVortex extends CRM_Core_DAO {
           0 => 'near_relation',
         ],
         'localizable' => FALSE,
-        'sig' => 'civicrm_relationship_vtx::0::near_relation',
+        'sig' => 'civicrm_relationship_cache::0::near_relation',
       ],
     ];
     return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
index db3fd969dd79d1a53355cf4d5335a31baea4a76c..fcf35a9eed48de57689ec135ddc6eab43153c15c 100644 (file)
@@ -567,10 +567,10 @@ return [
     'class' => 'CRM_Contact_DAO_Relationship',
     'table' => 'civicrm_relationship',
   ],
-  'CRM_Contact_DAO_RelationshipVortex' => [
-    'name' => 'RelationshipVortex',
-    'class' => 'CRM_Contact_DAO_RelationshipVortex',
-    'table' => 'civicrm_relationship_vtx',
+  'CRM_Contact_DAO_RelationshipCache' => [
+    'name' => 'RelationshipCache',
+    'class' => 'CRM_Contact_DAO_RelationshipCache',
+    'table' => 'civicrm_relationship_cache',
   ],
   'CRM_Mailing_DAO_Mailing' => [
     'name' => 'Mailing',
index bb2aa19ca87afc80ef86f5f1cb11f3cca2372836..f384a5f57a98c345609f521eea2793f6fc5a5a9c 100644 (file)
@@ -65,12 +65,12 @@ class CRM_Upgrade_Incremental_php_FiveTwentyNine extends CRM_Upgrade_Incremental
       FROM civicrm_relationship ")->getDatabaseResult()->fetchRow();
     for ($startId = $minId; $startId <= $maxId; $startId += self::BATCH_SIZE) {
       $endId = $startId + self::BATCH_SIZE - 1;
-      $title = ts("Upgrade DB to %1: Fill civicrm_relationship_vtx (%2 => %3)", [
+      $title = ts("Upgrade DB to %1: Fill civicrm_relationship_cache (%2 => %3)", [
         1 => $rev,
         2 => $startId,
         3 => $endId,
       ]);
-      $this->addTask($title, 'populateRelationshipVortex', $startId, $endId);
+      $this->addTask($title, 'populateRelationshipCache', $startId, $endId);
     }
   }
 
@@ -115,8 +115,8 @@ class CRM_Upgrade_Incremental_php_FiveTwentyNine extends CRM_Upgrade_Incremental
    * @return bool
    *   TRUE on success
    */
-  public static function populateRelationshipVortex(CRM_Queue_TaskContext $ctx, $startId, $endId) {
-    // NOTE: We duplicate CRM_Contact_BAO_RelationshipVortex::$mappings in case
+  public static function populateRelationshipCache(CRM_Queue_TaskContext $ctx, $startId, $endId) {
+    // NOTE: We duplicate CRM_Contact_BAO_RelationshipCache::$mappings in case
     // the schema evolves over multiple releases.
     $mappings = [
       'a_b' => [
@@ -151,7 +151,7 @@ class CRM_Upgrade_Incremental_php_FiveTwentyNine extends CRM_Upgrade_Incremental
     foreach ($mappings as $mapping) {
       $query = CRM_Utils_SQL_Select::from('civicrm_relationship rel')
         ->join('reltype', 'INNER JOIN civicrm_relationship_type reltype ON rel.relationship_type_id = reltype.id')
-        ->syncInto('civicrm_relationship_vtx', $keyFields, $mapping)
+        ->syncInto('civicrm_relationship_cache', $keyFields, $mapping)
         ->where('rel.id >= #START AND rel.id <= #END', [
           '#START' => $startId,
           '#END' => $endId,
index 2fefa417eb2ec20805136b4f675186c53b631295..3483c5ebde16054e80e4efd6e87e28fe76f1863e 100644 (file)
@@ -1,12 +1,12 @@
 {* file to handle db changes in 5.29.alpha1 during upgrade *}
 
--- The RelationshipVortex is a high-level index/cache for querying relationships.
-DROP TABLE IF EXISTS `civicrm_relationship_vtx`;
-CREATE TABLE `civicrm_relationship_vtx` (
-     `id` int unsigned NOT NULL AUTO_INCREMENT  COMMENT 'Relationship Vortex ID',
+-- The RelationshipCache is a high-level index/cache for querying relationships.
+DROP TABLE IF EXISTS `civicrm_relationship_cache`;
+CREATE TABLE `civicrm_relationship_cache` (
+     `id` int unsigned NOT NULL AUTO_INCREMENT  COMMENT 'Relationship Cache ID',
      `relationship_id` int unsigned NOT NULL   COMMENT 'id of the relationship (FK to civicrm_relationship.id)',
      `relationship_type_id` int unsigned NOT NULL   COMMENT 'id of the relationship type',
-     `orientation` char(3) NOT NULL   COMMENT 'The vortex record is a permutation of the original relationship record. The orientation indicates whether it is forward (a_b) or reverse (b_a) relationship.',
+     `orientation` char(3) NOT NULL   COMMENT 'The cache record is a permutation of the original relationship record. The orientation indicates whether it is forward (a_b) or reverse (b_a) relationship.',
      `near_contact_id` int unsigned NOT NULL   COMMENT 'id of the first contact',
      `near_relation` varchar(64)    COMMENT 'name for relationship of near_contact to far_contact.',
      `far_contact_id` int unsigned NOT NULL   COMMENT 'id of the second contact',
@@ -20,9 +20,9 @@ CREATE TABLE `civicrm_relationship_vtx` (
      INDEX `index_nearid_nearrelation`(near_contact_id, near_relation),
      INDEX `index_nearid_farrelation`(near_contact_id, far_relation),
      INDEX `index_near_relation`(near_relation),
-     CONSTRAINT FK_civicrm_relationship_vtx_relationship_id FOREIGN KEY (`relationship_id`) REFERENCES `civicrm_relationship`(`id`) ON DELETE CASCADE,
-     CONSTRAINT FK_civicrm_relationship_vtx_relationship_type_id FOREIGN KEY (`relationship_type_id`) REFERENCES `civicrm_relationship_type`(`id`) ON DELETE CASCADE,
-     CONSTRAINT FK_civicrm_relationship_vtx_near_contact_id FOREIGN KEY (`near_contact_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE CASCADE,
-     CONSTRAINT FK_civicrm_relationship_vtx_far_contact_id FOREIGN KEY (`far_contact_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE CASCADE,
-     CONSTRAINT FK_civicrm_relationship_vtx_case_id FOREIGN KEY (`case_id`) REFERENCES `civicrm_case`(`id`) ON DELETE CASCADE
+     CONSTRAINT FK_civicrm_relationship_cache_relationship_id FOREIGN KEY (`relationship_id`) REFERENCES `civicrm_relationship`(`id`) ON DELETE CASCADE,
+     CONSTRAINT FK_civicrm_relationship_cache_relationship_type_id FOREIGN KEY (`relationship_type_id`) REFERENCES `civicrm_relationship_type`(`id`) ON DELETE CASCADE,
+     CONSTRAINT FK_civicrm_relationship_cache_near_contact_id FOREIGN KEY (`near_contact_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE CASCADE,
+     CONSTRAINT FK_civicrm_relationship_cache_far_contact_id FOREIGN KEY (`far_contact_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE CASCADE,
+     CONSTRAINT FK_civicrm_relationship_cache_case_id FOREIGN KEY (`case_id`) REFERENCES `civicrm_case`(`id`) ON DELETE CASCADE
 )  ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
index 624e8659fae6c520d521c3577774e5031bf7b316..2e2435a30f348b1e6d2eba008b557dd8b7fb0bc3 100644 (file)
@@ -355,7 +355,7 @@ class Container {
     $dispatcher->addListener('hook_civicrm_coreResourceList', ['\CRM_Utils_System', 'appendCoreResources']);
     $dispatcher->addListener('hook_civicrm_getAssetUrl', ['\CRM_Utils_System', 'alterAssetUrl']);
     $dispatcher->addListener('hook_civicrm_alterExternUrl', ['\CRM_Utils_System', 'migrateExternUrl'], 1000);
-    $dispatcher->addListener('hook_civicrm_triggerInfo', ['\CRM_Contact_BAO_RelationshipVortex', 'onHookTriggerInfo']);
+    $dispatcher->addListener('hook_civicrm_triggerInfo', ['\CRM_Contact_BAO_RelationshipCache', 'onHookTriggerInfo']);
     $dispatcher->addListener('civi.dao.postInsert', ['\CRM_Core_BAO_RecurringEntity', 'triggerInsert']);
     $dispatcher->addListener('civi.dao.postUpdate', ['\CRM_Core_BAO_RecurringEntity', 'triggerUpdate']);
     $dispatcher->addListener('civi.dao.postDelete', ['\CRM_Core_BAO_RecurringEntity', 'triggerDelete']);
similarity index 83%
rename from tests/phpunit/CRM/Contact/BAO/RelationshipVortexTest.php
rename to tests/phpunit/CRM/Contact/BAO/RelationshipCacheTest.php
index e3c654c38fc4fd1d05d80efa485ecfa8c55fc712..9c5f900178ecf4dc2114c528624cc791a0b9d059 100644 (file)
  */
 
 /**
- * Test class for CRM_Contact_BAO_RelationshipVortex
+ * Test class for CRM_Contact_BAO_RelationshipCache
  *
  * @package CiviCRM
  * @group headless
  */
-class RelationshipVortexTest extends CiviUnitTestCase {
+class RelationshipCacheTest extends CiviUnitTestCase {
 
   protected function setUp() {
     $this->useTransaction(TRUE);
@@ -24,9 +24,9 @@ class RelationshipVortexTest extends CiviUnitTestCase {
 
   /**
    * Whenever one `Relationship` is created, there should be two corresponding
-   * `RelationshipVortex` records.
+   * `RelationshipCache` records.
    */
-  public function testRelationshipVortex() {
+  public function testRelationshipCache() {
     // add a new type
     $relationship_type_id_1 = $this->relationshipTypeCreate([
       'name_a_b' => 'Praegustator is',
@@ -47,14 +47,14 @@ class RelationshipVortexTest extends CiviUnitTestCase {
     ];
     $relationshipObj = CRM_Contact_BAO_Relationship::add($params);
 
-    // Let's make sure the vortex records were created!
-    $vtxs = CRM_Core_DAO::executeQuery('SELECT * FROM civicrm_relationship_vtx WHERE relationship_id = %1', [
+    // Let's make sure the cache records were created!
+    $caches = CRM_Core_DAO::executeQuery('SELECT * FROM civicrm_relationship_cache WHERE relationship_id = %1', [
       1 => [$relationshipObj->id, 'Positive'],
     ])->fetchAll();
 
     // There should be two records - the a_b record and the b_a record.
-    $this->assertCount(2, $vtxs);
-    $idx = CRM_Utils_Array::index(['orientation'], $vtxs);
+    $this->assertCount(2, $caches);
+    $idx = CRM_Utils_Array::index(['orientation'], $caches);
 
     $this->assertEquals($relationship_type_id_1, $idx['a_b']['relationship_type_id']);
     $this->assertEquals($contact_id_1, $idx['a_b']['near_contact_id']);
index eba607a8019c2c0eb83704d0adfe209170ea98ff..c0709f0c5652b00843a42b98133184a85c4f9aca 100644 (file)
@@ -300,7 +300,7 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
     $this->assertEquals($sortRefs(array_diff_key($this->getCalculatedCIDRefs(), $unsetRefs)), $sortRefs(CRM_Dedupe_Merger::cidRefs()));
 
     // These are deliberately unset.
-    // $unsetRefs = array_fill_keys(['civicrm_group_contact_cache', 'civicrm_acl_cache', 'civicrm_acl_contact_cache', 'civicrm_relationship_vtx'], 1);
+    // $unsetRefs = array_fill_keys(['civicrm_group_contact_cache', 'civicrm_acl_cache', 'civicrm_acl_contact_cache', 'civicrm_relationship_cache'], 1);
     // $this->assertEquals(array_diff_key($this->getStaticCIDRefs(), $unsetRefs), CRM_Dedupe_Merger::cidRefs());
     // $this->assertEquals(array_diff_key($this->getCalculatedCIDRefs(), $unsetRefs), CRM_Dedupe_Merger::cidRefs());
   }
@@ -1343,7 +1343,7 @@ class CRM_Dedupe_MergerTest extends CiviUnitTestCase {
         0 => 'contact_id_a',
         1 => 'contact_id_b',
       ],
-      'civicrm_relationship_vtx' => [
+      'civicrm_relationship_cache' => [
         0 => 'near_contact_id',
         1 => 'far_contact_id',
       ],
similarity index 83%
rename from xml/schema/Contact/RelationshipVortex.xml
rename to xml/schema/Contact/RelationshipCache.xml
index c18ac9154f9a746dc3a893459889658b5502cb0a..3c80d0e183ca651c6a8fd63c02d40ee6548f1419 100644 (file)
@@ -2,9 +2,9 @@
 
 <table>
   <base>CRM/Contact</base>
-  <class>RelationshipVortex</class>
-  <name>civicrm_relationship_vtx</name>
-  <comment>The vortex permutes information from the relationship table to facilitate querying. Every relationship is mapped to multiple records in the vortex. Joins should begin on the near side and extract info from the far side.</comment>
+  <class>RelationshipCache</class>
+  <name>civicrm_relationship_cache</name>
+  <comment>The cache permutes information from the relationship table to facilitate querying. Every relationship is mapped to multiple records in the cache. Joins should begin on the near side and extract info from the far side.</comment>
   <add>5.29</add>
   <log>false</log>
   <icon>fa-handshake-o</icon>
@@ -12,9 +12,9 @@
   <field>
     <name>id</name>
     <type>int unsigned</type>
-    <title>Relationship Vortex ID</title>
+    <title>Relationship Cache ID</title>
     <required>true</required>
-    <comment>Relationship Vortex ID</comment>
+    <comment>Relationship Cache ID</comment>
     <add>5.29</add>
   </field>
   <primaryKey>
@@ -61,7 +61,7 @@
     <title>Orientation (a_b or b_a)</title>
     <required>true</required>
     <default></default>
-    <comment>The vortex record is a permutation of the original relationship record. The orientation indicates whether it is forward (a_b) or reverse (b_a) relationship.</comment>
+    <comment>The cache record is a permutation of the original relationship record. The orientation indicates whether it is forward (a_b) or reverse (b_a) relationship.</comment>
     <add>5.29</add>
   </field>
 
     <add>5.29</add>
   </index>
   <index>
-    <!-- Ex: select ... from contact inner join vtx on contact.id=vtx.near_contact_id and near_relation = 'Parent of' -->
+    <!-- Ex: select ... from contact inner join relcache on contact.id=relcache.near_contact_id and near_relation = 'Parent of' -->
     <name>index_nearid_nearrelation</name>
     <fieldName>near_contact_id</fieldName>
     <fieldName>near_relation</fieldName>
     <add>5.29</add>
   </index>
   <index>
-    <!-- Ex: select ... from contact inner join vtx on contact.id=vtx.near_contact_id and far_relation = 'Child of' -->
+    <!-- Ex: select ... from contact inner join relcache on contact.id=relcache.near_contact_id and far_relation = 'Child of' -->
     <name>index_nearid_farrelation</name>
     <fieldName>near_contact_id</fieldName>
     <fieldName>far_relation</fieldName>
     <add>5.29</add>
   </index>
   <index>
-    <!-- Ex: select relation, count(*) from vtx group by relation -->
+    <!-- Ex: select relation, count(*) from relcache group by near_relation -->
     <name>index_near_relation</name>
     <fieldName>near_relation</fieldName>
     <add>5.29</add>
index dd9ea40d1cc0525978c334ad528e18ab52e06a6d..7ffa2241cecccda936c5220bd5aa8d847235f1df 100644 (file)
@@ -13,7 +13,7 @@
 <xi:include href="GroupOrganization.xml"    parse="xml" />
 <xi:include href="Relationship.xml"         parse="xml" />
 <xi:include href="RelationshipType.xml"     parse="xml" />
-<xi:include href="RelationshipVortex.xml"   parse="xml" />
+<xi:include href="RelationshipCache.xml"    parse="xml" />
 <xi:include href="SavedSearch.xml"          parse="xml" />
 <xi:include href="ContactType.xml"          parse="xml" />