APIv4 - Use non-deprecated join syntax internally
authorColeman Watts <coleman@civicrm.org>
Mon, 28 Jun 2021 16:37:06 +0000 (12:37 -0400)
committerColeman Watts <coleman@civicrm.org>
Tue, 29 Jun 2021 12:49:20 +0000 (08:49 -0400)
Updates APIv4 calls in CiviCRM core to use e.g. `event_id.title` instead of `event.title`

30 files changed:
CRM/Contact/Form/Task/EmailTrait.php
CRM/Contribute/BAO/Contribution.php
CRM/Contribute/BAO/ContributionPage.php
CRM/Contribute/Form/Task/Invoice.php
CRM/Dedupe/Merger.php
CRM/Event/Form/ManageEvent/Location.php
CRM/Event/Page/UserDashboard.php
CRM/Financial/BAO/Order.php
Civi/Api4/Generic/Traits/DAOActionTrait.php
Civi/Api4/Service/Schema/Joinable/CustomGroupJoinable.php
Civi/Api4/Service/Spec/SpecFormatter.php
Civi/Api4/Service/Spec/SpecGatherer.php
Civi/Test/Api3TestTrait.php
ext/afform/core/Civi/Afform/AfformMetadataInjector.php
ext/oauth-client/tests/phpunit/api/v4/OAuthContactTokenTest.php
ext/oauth-client/tests/phpunit/api/v4/OAuthSysTokenTest.php
ext/search_kit/Civi/Search/AfformSearchMetadataInjector.php
tests/phpunit/CRM/Event/Form/ManageEvent/LocationTest.php
tests/phpunit/api/v3/ACLPermissionTest.php
tests/phpunit/api/v4/Action/ContactApiKeyTest.php
tests/phpunit/api/v4/Action/ContactGetTest.php
tests/phpunit/api/v4/Action/FkJoinTest.php
tests/phpunit/api/v4/Action/PseudoconstantTest.php
tests/phpunit/api/v4/Entity/ContactInterchangeTest.php
tests/phpunit/api/v4/Entity/ContactTypeTest.php
tests/phpunit/api/v4/Query/Api4SelectQueryTest.php
tests/phpunit/api/v4/Query/PermissionCheckTest.php
tests/phpunit/api/v4/Query/SelectQueryMultiJoinTest.php
tests/phpunit/api/v4/Spec/SpecFormatterTest.php
tests/phpunit/api/v4/Utils/SelectUtilTest.php

index dc7771acfbc158d40f01c41dfc5723979ab015a5..df222411a1a7d3263a03b6ae968570a2a0ab16ff 100644 (file)
@@ -529,11 +529,11 @@ trait CRM_Contact_Form_Task_EmailTrait {
     $emails = Email::get()
       ->addWhere('id', 'IN', $emailIDs)
       ->setCheckPermissions(FALSE)
-      ->setSelect(['contact_id', 'email', 'contact.sort_name', 'contact.display_name'])->execute();
+      ->setSelect(['contact_id', 'email', 'contact_id.sort_name', 'contact_id.display_name'])->execute();
     $emailStrings = [];
     foreach ($emails as $email) {
       $this->contactEmails[$email['id']] = $email;
-      $emailStrings[] = '"' . $email['contact.sort_name'] . '" <' . $email['email'] . '>';
+      $emailStrings[] = '"' . $email['contact_id.sort_name'] . '" <' . $email['email'] . '>';
     }
     return implode(',', $emailStrings);
   }
@@ -552,7 +552,7 @@ trait CRM_Contact_Form_Task_EmailTrait {
     $urls = [];
     foreach ($emailIDs as $email) {
       $contactURL = CRM_Utils_System::url('civicrm/contact/view', ['reset' => 1, 'cid' => $this->contactEmails[$email]['contact_id']], TRUE);
-      $urls[] = "<a href='{$contactURL}'>" . $this->contactEmails[$email]['contact.display_name'] . '</a>';
+      $urls[] = "<a href='{$contactURL}'>" . $this->contactEmails[$email]['contact_id.display_name'] . '</a>';
     }
     return implode(', ', $urls);
   }
index 131a9fa4004614fc2a3909487d94e22091d7f6f5..e35fcdb1a506abaac982d0786db7cb1a463b5fe5 100644 (file)
@@ -1318,13 +1318,13 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
       return (bool) ContributionRecur::get(FALSE)->addWhere('id', '=', $recurringContributionID)->addSelect('is_email_receipt')->execute()->first()['is_email_receipt'];
     }
     $contributionPage = Contribution::get(FALSE)
-      ->addSelect('contribution_page.is_email_receipt')
+      ->addSelect('contribution_page_id.is_email_receipt')
       ->addWhere('contribution_page_id', 'IS NOT NULL')
       ->addWhere('id', '=', $contributionID)
       ->execute()->first();
 
     if (!empty($contributionPage)) {
-      return (bool) $contributionPage['contribution_page.is_email_receipt'];
+      return (bool) $contributionPage['contribution_page_id.is_email_receipt'];
     }
     // This would be the case for backoffice (where is_email_receipt is not passed in) or events, where Event::sendMail will filter
     // again anyway.
index 806e8aa6834d74e0bb696eb134968ed91464a3e2..0d57b7d06f642ef72731969757582b45b4bf45f7 100644 (file)
@@ -522,13 +522,13 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
         'contribution_page_id',
         'contact_id',
         'contribution_recur_id',
-        'contribution_recur.is_email_receipt',
-        'contribution_page.title',
-        'contribution_page.is_email_receipt',
-        'contribution_page.receipt_from_name',
-        'contribution_page.receipt_from_email',
-        'contribution_page.cc_receipt',
-        'contribution_page.bcc_receipt',
+        'contribution_recur_id.is_email_receipt',
+        'contribution_page_id.title',
+        'contribution_page_id.is_email_receipt',
+        'contribution_page_id.receipt_from_name',
+        'contribution_page_id.receipt_from_email',
+        'contribution_page_id.cc_receipt',
+        'contribution_page_id.bcc_receipt',
       ])
       ->execute()->first();
 
@@ -537,10 +537,10 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
       ->addWhere('entity_table', '=', 'civicrm_membership')
       ->addSelect('id')->execute()->first());
 
-    if ($contribution['contribution_recur.is_email_receipt'] || $contribution['contribution_page.is_email_receipt']) {
-      if ($contribution['contribution_page.receipt_from_email']) {
-        $receiptFromName = $contribution['contribution_page.receipt_from_name'];
-        $receiptFromEmail = $contribution['contribution_page.receipt_from_email'];
+    if ($contribution['contribution_recur_id.is_email_receipt'] || $contribution['contribution_page_id.is_email_receipt']) {
+      if ($contribution['contribution_page_id.receipt_from_email']) {
+        $receiptFromName = $contribution['contribution_page_id.receipt_from_name'];
+        $receiptFromEmail = $contribution['contribution_page_id.receipt_from_email'];
       }
       else {
         [$receiptFromName, $receiptFromEmail] = CRM_Core_BAO_Domain::getNameAndEmail();
@@ -570,8 +570,8 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
         'toEmail' => $email,
       ];
       //CRM-13811
-      $templatesParams['cc'] = $contribution['contribution_page.cc_receipt'];
-      $templatesParams['bcc'] = $contribution['contribution_page.cc_receipt'];
+      $templatesParams['cc'] = $contribution['contribution_page_id.cc_receipt'];
+      $templatesParams['bcc'] = $contribution['contribution_page_id.cc_receipt'];
       if ($recur->id) {
         // in some cases its just recurringNotify() thats called for the first time and these urls don't get set.
         // like in PaypalPro, & therefore we set it here additionally.
index 7da9b101c4438a3662acb8a18aa7fc7f24614966..64e903df881fc77590307d4965e7378ba3317daa 100644 (file)
@@ -430,13 +430,13 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task {
         $emails = Email::get()
           ->addWhere('id', 'IN', $emailIDs)
           ->setCheckPermissions(FALSE)
-          ->setSelect(['contact_id', 'email', 'contact.sort_name', 'contact.display_name'])->execute();
+          ->setSelect(['contact_id', 'email', 'contact_id.sort_name', 'contact_id.display_name'])->execute();
         $emailStrings = $contactUrlStrings = [];
         foreach ($emails as $email) {
-          $emailStrings[] = '"' . $email['contact.sort_name'] . '" <' . $email['email'] . '>';
+          $emailStrings[] = '"' . $email['contact_id.sort_name'] . '" <' . $email['email'] . '>';
           // generate the contact url to put in Activity
           $contactURL = CRM_Utils_System::url('civicrm/contact/view', ['reset' => 1, 'force' => 1, 'cid' => $email['contact_id']], TRUE);
-          $contactUrlStrings[] = "<a href='{$contactURL}'>" . $email['contact.display_name'] . '</a>';
+          $contactUrlStrings[] = "<a href='{$contactURL}'>" . $email['contact_id.display_name'] . '</a>';
         }
         $cc_emails = implode(',', $emailStrings);
         $values['cc_receipt'] = $cc_emails;
index f347897568f058ef510c8df3eaf494316058964f..aa3daad5aa494ad884053cab7e0cc80580aa22bf 100644 (file)
@@ -655,14 +655,14 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
    */
   protected static function getMultiValueCidRefs() {
     $fields = \Civi\Api4\CustomField::get(FALSE)
-      ->addSelect('custom_group.table_name', 'column_name', 'serialize')
+      ->addSelect('custom_group_id.table_name', 'column_name', 'serialize')
       ->addWhere('data_type', '=', 'ContactReference')
       ->addWhere('serialize', 'IS NOT EMPTY')
       ->execute();
 
     $map = [];
     foreach ($fields as $field) {
-      $map[$field['custom_group.table_name']][$field['column_name']] = $field['serialize'];
+      $map[$field['custom_group_id.table_name']][$field['column_name']] = $field['serialize'];
     }
     return $map;
   }
index b0d045da488255d82dbf36c20dc3f13485cec007..b1187ad4aa4ed2912cc7cfdfac2d9eb7a606b06f 100644 (file)
@@ -156,7 +156,7 @@ class CRM_Event_Form_ManageEvent_Location extends CRM_Event_Form_ManageEvent {
     if ($this->_id) {
       $this->locationBlock = Event::get()
         ->addWhere('id', '=', $this->_id)
-        ->setSelect(['loc_block.*', 'loc_block_id'])
+        ->setSelect(['loc_block_id.*', 'loc_block_id'])
         ->execute()->first();
       $this->_oldLocBlockId = $this->locationBlock['loc_block_id'];
     }
@@ -249,8 +249,8 @@ class CRM_Event_Form_ManageEvent_Location extends CRM_Event_Form_ManageEvent {
         }
         $params[$block][$index]['location_type_id'] = $defaultLocationTypeID;
         $fieldKey = (int) $index === 1 ? '_id' : '_2_id';
-        if ($isUpdateToExistingLocationBlock && !empty($this->locationBlock['loc_block.' . $block . $fieldKey])) {
-          $params[$block][$index]['id'] = $this->locationBlock['loc_block.' . $block . $fieldKey];
+        if ($isUpdateToExistingLocationBlock && !empty($this->locationBlock['loc_block_id.' . $block . $fieldKey])) {
+          $params[$block][$index]['id'] = $this->locationBlock['loc_block_id.' . $block . $fieldKey];
         }
       }
     }
index e1c0aa73c2c089217de4a78efd2b0d020e3a11aa..f384ae5de53ad95130f9fc97647c7f36852a5d60 100644 (file)
@@ -28,9 +28,9 @@ class CRM_Event_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBoard {
     $event_rows = [];
 
     $participants = \Civi\Api4\Participant::get(FALSE)
-      ->addSelect('id', 'contact_id', 'status_id:name', 'status_id:label', 'event.id', 'event.title', 'event.start_date', 'event.end_date')
+      ->addSelect('id', 'contact_id', 'status_id:name', 'status_id:label', 'event_id', 'event_id.title', 'event_id.start_date', 'event_id.end_date')
       ->addWhere('contact_id', '=', $this->_contactId)
-      ->addOrderBy('event.start_date', 'DESC')
+      ->addOrderBy('event_id.start_date', 'DESC')
       ->execute()
       ->indexBy('id');
 
@@ -39,10 +39,10 @@ class CRM_Event_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBoard {
       $p['participant_id'] = $p['id'];
       $p['status'] = $p['status_id:name'];
       $p['participant_status'] = $p['status_id:label'];
-      $p['event_id'] = $p['event.id'];
-      $p['event_title'] = $p['event.title'];
-      $p['event_start_date'] = $p['event.start_date'];
-      $p['event_end_date'] = $p['event.end_date'];
+      $p['event_id'] = $p['event_id'];
+      $p['event_title'] = $p['event_id.title'];
+      $p['event_start_date'] = $p['event_id.start_date'];
+      $p['event_end_date'] = $p['event_id.end_date'];
 
       $event_rows[] = $p;
     }
index 9f5df990e5aa9422573a7cd9fd1b7e9787507998..ed96a7a22ef47aa6d179e673c0a487456fb3a2df 100644 (file)
@@ -438,7 +438,7 @@ class CRM_Financial_BAO_Order {
   public function getDefaultPriceField() {
     return PriceField::get(FALSE)
       ->addWhere('name', '=', 'contribution_amount')
-      ->addWhere('price_set.name', '=', 'default_contribution_amount')
+      ->addWhere('price_set_id.name', '=', 'default_contribution_amount')
       ->execute()->first()['id'];
   }
 
index 76df9951a41d4b58eaaba7e34dd860be6bcaa49b..9e225bc79b9eb27f724edbe51a0e3e6186989cf8 100644 (file)
@@ -236,7 +236,7 @@ trait DAOActionTrait {
           $field['id'],
           $customParams,
           $value,
-          $field['custom_group.extends'],
+          $field['custom_group_id.extends'],
           // todo check when this is needed
           NULL,
           $entityId,
@@ -270,13 +270,13 @@ trait DAOActionTrait {
     if (!isset($info[$fieldName])) {
       $info = [];
       $fields = CustomField::get(FALSE)
-        ->addSelect('id', 'name', 'html_type', 'data_type', 'custom_group.extends')
-        ->addWhere('custom_group.name', '=', $groupName)
+        ->addSelect('id', 'name', 'html_type', 'data_type', 'custom_group_id.extends')
+        ->addWhere('custom_group_id.name', '=', $groupName)
         ->execute()->indexBy('name');
       foreach ($fields as $name => $field) {
         $field['custom_field_id'] = $field['id'];
         $field['name'] = $groupName . '.' . $name;
-        $field['entity'] = CustomGroupJoinable::getEntityFromExtends($field['custom_group.extends']);
+        $field['entity'] = CustomGroupJoinable::getEntityFromExtends($field['custom_group_id.extends']);
         $info[$name] = $field;
       }
       \Civi::cache('metadata')->set($cacheKey, $info);
index 3b764c150d81aaeaff91d6c545ca9cd36485dde0..4bff31bf69cad099d5da86bf6b762ae502b41b4b 100644 (file)
@@ -53,11 +53,11 @@ class CustomGroupJoinable extends Joinable {
     $entityFields = (array) \Civi::cache('metadata')->get($cacheKey);
     if (!$entityFields) {
       $fields = CustomField::get(FALSE)
-        ->setSelect(['custom_group.name', 'custom_group.extends', 'custom_group.table_name', 'custom_group.title', '*'])
-        ->addWhere('custom_group.table_name', '=', $this->getTargetTable())
+        ->setSelect(['custom_group_id.name', 'custom_group_id.extends', 'custom_group_id.table_name', 'custom_group_id.title', '*'])
+        ->addWhere('custom_group_id.table_name', '=', $this->getTargetTable())
         ->execute();
       foreach ($fields as $field) {
-        $entityFields[] = \Civi\Api4\Service\Spec\SpecFormatter::arrayToField($field, self::getEntityFromExtends($field['custom_group.extends']));
+        $entityFields[] = \Civi\Api4\Service\Spec\SpecFormatter::arrayToField($field, self::getEntityFromExtends($field['custom_group_id.extends']));
       }
       \Civi::cache('metadata')->set($cacheKey, $entityFields);
     }
index ca67cb9db6dc2b7929932100db9718958753e100..6eae4b396d4f412a0a4e019d62dfbf7716736401 100644 (file)
@@ -29,16 +29,16 @@ class SpecFormatter {
     if (!empty($data['custom_group_id'])) {
       $field = new CustomFieldSpec($data['name'], $entity, $dataTypeName);
       if (strpos($entity, 'Custom_') !== 0) {
-        $field->setName($data['custom_group.name'] . '.' . $data['name']);
+        $field->setName($data['custom_group_id.name'] . '.' . $data['name']);
       }
       else {
-        $field->setTableName($data['custom_group.table_name']);
+        $field->setTableName($data['custom_group_id.table_name']);
       }
       $field->setColumnName($data['column_name']);
       $field->setCustomFieldId($data['id'] ?? NULL);
-      $field->setCustomGroupName($data['custom_group.name']);
+      $field->setCustomGroupName($data['custom_group_id.name']);
       $field->setTitle($data['label']);
-      $field->setLabel($data['custom_group.title'] . ': ' . $data['label']);
+      $field->setLabel($data['custom_group_id.title'] . ': ' . $data['label']);
       $field->setHelpPre($data['help_pre'] ?? NULL);
       $field->setHelpPost($data['help_post'] ?? NULL);
       if (self::customFieldHasOptions($data)) {
index bfa22bb133b331d3b50cb7549dd022bdb07c2794..f9369d75abc48dffac023aff28075bcdf8f1cfa3 100644 (file)
@@ -128,9 +128,9 @@ class SpecGatherer {
       $extends = $customInfo['extends'];
     }
     $customFields = CustomField::get(FALSE)
-      ->addWhere('custom_group.extends', 'IN', $extends)
-      ->addWhere('custom_group.is_multiple', '=', '0')
-      ->setSelect(['custom_group.name', 'custom_group.title', '*'])
+      ->addWhere('custom_group_id.extends', 'IN', $extends)
+      ->addWhere('custom_group_id.is_multiple', '=', '0')
+      ->setSelect(['custom_group_id.name', 'custom_group_id.title', '*'])
       ->execute();
 
     foreach ($customFields as $fieldArray) {
@@ -145,8 +145,8 @@ class SpecGatherer {
    */
   private function getCustomGroupFields($customGroup, RequestSpec $specification) {
     $customFields = CustomField::get(FALSE)
-      ->addWhere('custom_group.name', '=', $customGroup)
-      ->setSelect(['custom_group.name', 'custom_group.table_name', 'custom_group.title', '*'])
+      ->addWhere('custom_group_id.name', '=', $customGroup)
+      ->setSelect(['custom_group_id.name', 'custom_group_id.table_name', 'custom_group_id.title', '*'])
       ->execute();
 
     foreach ($customFields as $fieldArray) {
index bf5d3d83ef057ee1c575962024cca2b674b708d7..953e484b71fd88a1ded156ee76244d6cebdc7dbf 100644 (file)
@@ -403,7 +403,7 @@ trait Api3TestTrait {
         // This is a per field hack (bad) but we can't solve everything at once
         // & a cleverer way turned out to be too much for this round.
         // Being in the test class it's tested....
-        $v3Params['option_group.name'] = $v3Params['option_group_id'];
+        $v3Params['option_group_id.name'] = $v3Params['option_group_id'];
         unset($v3Params['option_group_id']);
       }
       if (isset($field['pseudoconstant'], $v3Params[$name]) && $field['type'] === \CRM_Utils_Type::T_INT && !is_numeric($v3Params[$name]) && is_string($v3Params[$name])) {
index 3033386fe7e1b4ff4eed60eef7a1b83d39ee0f62..261aafa9213063532900d9b30ea65688431a2525 100644 (file)
@@ -28,7 +28,7 @@ class AfformMetadataInjector {
       ->alterHtml(';\\.aff\\.html$;', function($doc, $path) {
         try {
           $module = \Civi::service('angular')->getModule(basename($path, '.aff.html'));
-          $meta = \Civi\Api4\Afform::get()->addWhere('name', '=', $module['_afform'])->setSelect(['join', 'block'])->setCheckPermissions(FALSE)->execute()->first();
+          $meta = \Civi\Api4\Afform::get(FALSE)->addWhere('name', '=', $module['_afform'])->setSelect(['join', 'block'])->execute()->first();
         }
         catch (\Exception $e) {
         }
index 131bf6d73f1b959bea08f8a316945c9c7578efbf..ed19b092222533f01b1bc35d73a008b8e4a1b13d 100644 (file)
@@ -228,7 +228,7 @@ class api_v4_OAuthContactTokenTest extends \PHPUnit\Framework\TestCase implement
 
     $this->usePerms(['manage my OAuth contact tokens', 'view my contact']);
     $updateTokensWithLimitedAccess = Civi\Api4\OAuthContactToken::update()
-      ->addWhere('client.guid', '=', $client['guid'])
+      ->addWhere('client_id.guid', '=', $client['guid'])
       ->setValues(['access_token' => 'own-token-revised'])
       ->execute();
     $this->assertCount(1, $updateTokensWithLimitedAccess);
@@ -257,7 +257,7 @@ class api_v4_OAuthContactTokenTest extends \PHPUnit\Framework\TestCase implement
 
     $this->usePerms(['manage my OAuth contact tokens', 'view my contact']);
     $updateTokensForWrongContact = Civi\Api4\OAuthContactToken::update()
-      ->addWhere('contact.id', '=', $notLoggedInContactID)
+      ->addWhere('contact_id.id', '=', $notLoggedInContactID)
       // ^ sneaky way to update a different contact?
       ->setValues(['access_token' => "stranger-token-revised"])
       ->execute();
@@ -271,7 +271,7 @@ class api_v4_OAuthContactTokenTest extends \PHPUnit\Framework\TestCase implement
 
     $this->usePerms(['manage my OAuth contact tokens', 'view all contacts']);
     $deleteTokensWithLimitedAccess = Civi\Api4\OAuthContactToken::delete()
-      ->setWhere([['client.guid', '=', $client['guid']]])
+      ->setWhere([['client_id.guid', '=', $client['guid']]])
       ->execute();
 
     $this->usePerms(['manage my OAuth contact tokens', 'view all contacts']);
@@ -309,7 +309,7 @@ class api_v4_OAuthContactTokenTest extends \PHPUnit\Framework\TestCase implement
 
     $this->usePerms(['manage all OAuth contact tokens', 'view all contacts']);
     $getTokens = Civi\Api4\OAuthContactToken::get()
-      ->addWhere('client.provider', '=', $client['provider'])
+      ->addWhere('client_id.provider', '=', $client['provider'])
       ->addWhere('scopes', 'CONTAINS', 'foo')
       ->execute();
     $this->assertCount(1, $getTokens);
@@ -317,14 +317,14 @@ class api_v4_OAuthContactTokenTest extends \PHPUnit\Framework\TestCase implement
 
     $this->usePerms(['manage all OAuth contact tokens', 'view all contacts']);
     $getTokens = Civi\Api4\OAuthContactToken::get()
-      ->addWhere('client.provider', '=', $client['provider'])
+      ->addWhere('client_id.provider', '=', $client['provider'])
       ->addWhere('scopes', 'CONTAINS', 'nada')
       ->execute();
     $this->assertCount(0, $getTokens);
 
     $this->usePerms(['manage all OAuth contact tokens', 'view all contacts']);
     $getTokens = Civi\Api4\OAuthContactToken::get()
-      ->addWhere('client.provider', '=', 'some-other-provider')
+      ->addWhere('client_id.provider', '=', 'some-other-provider')
       ->addWhere('scopes', 'CONTAINS', 'foo')
       ->execute();
     $this->assertCount(0, $getTokens);
index bcd061413854be7bdf048f15c3f3f83145e3ffa1..01984f4a82e180bb533206f96fe4ea740b642520 100644 (file)
@@ -70,7 +70,7 @@ class api_v4_OAuthSysTokenTest extends \PHPUnit\Framework\TestCase implements He
 
     $usePerms(['manage OAuth client', 'manage OAuth client secrets']);
     $updateToken = Civi\Api4\OAuthSysToken::update()
-      ->setWhere([['client.guid', '=', "example-id-$random"]])
+      ->setWhere([['client_id.guid', '=', "example-id-$random"]])
       ->setValues(['access_token' => "revised-access-token-$random"])
       ->execute();
 
@@ -141,7 +141,7 @@ class api_v4_OAuthSysTokenTest extends \PHPUnit\Framework\TestCase implements He
     $usePerms(['manage OAuth client']);
     try {
       Civi\Api4\OAuthSysToken::update()
-        ->setWhere([['client.guid', '=', "example-id-$random"]])
+        ->setWhere([['client_id.guid', '=', "example-id-$random"]])
         ->setValues(['access_token' => "revised-access-token-$random"])
         ->execute();
       $this->fail('Expected exception - User should not be able to write secret values.');
@@ -191,7 +191,7 @@ class api_v4_OAuthSysTokenTest extends \PHPUnit\Framework\TestCase implements He
 
     $usePerms(['manage OAuth client']);
     $getTokens = Civi\Api4\OAuthSysToken::get()
-      ->addWhere('client.provider', '=', 'test_example_1')
+      ->addWhere('client_id.provider', '=', 'test_example_1')
       ->addWhere('scopes', 'CONTAINS', 'foo')
       ->execute();
     $this->assertEquals(1, count($getTokens));
@@ -199,14 +199,14 @@ class api_v4_OAuthSysTokenTest extends \PHPUnit\Framework\TestCase implements He
 
     $usePerms(['manage OAuth client']);
     $getTokens = Civi\Api4\OAuthSysToken::get()
-      ->addWhere('client.provider', '=', 'test_example_1')
+      ->addWhere('client_id.provider', '=', 'test_example_1')
       ->addWhere('scopes', 'CONTAINS', 'nada')
       ->execute();
     $this->assertEquals(0, count($getTokens));
 
     $usePerms(['manage OAuth client']);
     $getTokens = Civi\Api4\OAuthSysToken::get()
-      ->addWhere('client.provider', '=', 'test_example_2')
+      ->addWhere('client_id.provider', '=', 'test_example_2')
       ->addWhere('scopes', 'CONTAINS', 'foo')
       ->execute();
     $this->assertEquals(0, count($getTokens));
index 0ab479f7ef7abe3fa6d967d832f285f7cdd589ba..f99bfdc29aa60a8a4fbc7c4d8f00e4449ddc3bbb 100644 (file)
@@ -35,19 +35,19 @@ class AfformSearchMetadataInjector {
             if ($searchName && $displayName) {
               $display = \Civi\Api4\SearchDisplay::get(FALSE)
                 ->addWhere('name', '=', $displayName)
-                ->addWhere('saved_search.name', '=', $searchName)
-                ->addSelect('settings', 'saved_search.api_entity', 'saved_search.api_params')
+                ->addWhere('saved_search_id.name', '=', $searchName)
+                ->addSelect('settings', 'saved_search_id.api_entity', 'saved_search_id.api_params')
                 ->execute()->first();
               if ($display) {
                 pq($component)->attr('settings', htmlspecialchars(\CRM_Utils_JS::encode($display['settings'] ?? [])));
-                pq($component)->attr('api-entity', htmlspecialchars($display['saved_search.api_entity']));
+                pq($component)->attr('api-entity', htmlspecialchars($display['saved_search_id.api_entity']));
                 pq($component)->attr('search', htmlspecialchars(\CRM_Utils_JS::encode($searchName)));
                 pq($component)->attr('display', htmlspecialchars(\CRM_Utils_JS::encode($displayName)));
 
                 // Add entity names to the fieldset so that afform can populate field metadata
                 $fieldset = pq($component)->parents('[af-fieldset]');
                 if ($fieldset->length) {
-                  $entityList = array_merge([$display['saved_search.api_entity']], array_column($display['saved_search.api_params']['join'] ?? [], 0));
+                  $entityList = array_merge([$display['saved_search_id.api_entity']], array_column($display['saved_search_id.api_params']['join'] ?? [], 0));
                   $fieldset->attr('api-entities', htmlspecialchars(\CRM_Utils_JS::encode($entityList)));
                 }
               }
index 58bcb441f42630c743c70f1a8a4634302a64eb3b..eece2165b5856aa932fa32d1f4089bf578ed2833 100644 (file)
@@ -78,10 +78,10 @@ class CRM_Event_Form_ManageEvent_LocationTest extends CiviUnitTestCase {
 
     $locationBlock = Event::get()
       ->addWhere('id', '=', $eventID)
-      ->setSelect(['loc_block.*', 'loc_block_id'])
+      ->setSelect(['loc_block_id.*', 'loc_block_id'])
       ->execute()->first();
 
-    $address = $this->callAPISuccessGetSingle('Address', ['id' => $locationBlock['loc_block.address_id']]);
+    $address = $this->callAPISuccessGetSingle('Address', ['id' => $locationBlock['loc_block_id.address_id']]);
 
     $this->assertEquals([
       'id' => $address['id'],
@@ -101,9 +101,9 @@ class CRM_Event_Form_ManageEvent_LocationTest extends CiviUnitTestCase {
       'manual_geo_code' => '0',
     ], $address);
 
-    $this->callAPISuccessGetSingle('Email', ['id' => $locationBlock['loc_block.email_id'], 'email' => 'john.smith@example.org']);
-    $this->callAPISuccessGetSingle('Phone', ['id' => $locationBlock['loc_block.phone_id'], 'phone' => '303443689']);
-    $this->callAPISuccessGetSingle('Phone', ['id' => $locationBlock['loc_block.phone_2_id'], 'phone' => '9833910234']);
+    $this->callAPISuccessGetSingle('Email', ['id' => $locationBlock['loc_block_id.email_id'], 'email' => 'john.smith@example.org']);
+    $this->callAPISuccessGetSingle('Phone', ['id' => $locationBlock['loc_block_id.phone_id'], 'phone' => '303443689']);
+    $this->callAPISuccessGetSingle('Phone', ['id' => $locationBlock['loc_block_id.phone_2_id'], 'phone' => '9833910234']);
 
     // Cleanup.
     CRM_Core_BAO_Location::deleteLocBlock($locationBlock['loc_block_id']);
@@ -255,12 +255,12 @@ class CRM_Event_Form_ManageEvent_LocationTest extends CiviUnitTestCase {
     $firstEmail = $emails->first();
     $locationBlock = Event::get()
       ->addWhere('id', '=', $eventID)
-      ->setSelect(['loc_block.*', 'loc_block_id'])
+      ->setSelect(['loc_block_id.*', 'loc_block_id'])
       ->execute()->first();
     $this->ids['LocBlock'][0] = $locationBlock['loc_block_id'];
-    $this->assertEquals($firstEmail['id'], $locationBlock['loc_block.email_id']);
+    $this->assertEquals($firstEmail['id'], $locationBlock['loc_block_id.email_id']);
     $secondEmail = $emails->last();
-    $this->assertEquals($secondEmail['id'], $locationBlock['loc_block.email_2_id']);
+    $this->assertEquals($secondEmail['id'], $locationBlock['loc_block_id.email_2_id']);
     return $emails;
   }
 
index d9a969993eb29368a409d97012dcd336fbb18897..67877a67b7127d7c9974705360cf357b0a4eac21 100644 (file)
@@ -1077,7 +1077,7 @@ class api_v3_ACLPermissionTest extends CiviUnitTestCase {
     $tag2 = $this->tagCreate(['name' => uniqid('other'), 'created_id' => $other])['id'];
     $this->setPermissions(['access CiviCRM']);
     $this->hookClass->setHook('civicrm_aclWhereClause', [$this, 'aclWhereHookAllResults']);
-    $createdFirstName = $version === 4 ? 'created.first_name' : 'created_id.first_name';
+    $createdFirstName = 'created_id.first_name';
     $result = $this->callAPISuccess('Tag', 'get', [
       'check_permissions' => 1,
       'return' => ['id', $createdFirstName],
index 19202a52c52a1ca4859a7f3e87ea023d9cea3bc8..afa8fed64a271964bd5e1a56774caf8c220abd62 100644 (file)
@@ -57,10 +57,10 @@ class ContactApiKeyTest extends \api\v4\UnitTestCase {
 
     // Can also be fetched via join
     $email = Email::get()
-      ->addSelect('contact.api_key')
+      ->addSelect('contact_id.api_key')
       ->addWhere('id', '=', $contact['email']['id'])
       ->execute()->first();
-    $this->assertEquals($key, $email['contact.api_key']);
+    $this->assertEquals($key, $email['contact_id.api_key']);
     $this->assertFalse($isSafe($email), "Should reveal secret details ($key): " . var_export($email, 1));
 
     // Remove permission and we should not see the key
@@ -76,12 +76,12 @@ class ContactApiKeyTest extends \api\v4\UnitTestCase {
 
     // Also not available via join
     $email = Email::get()
-      ->addSelect('contact.api_key')
+      ->addSelect('contact_id.api_key')
       ->addWhere('id', '=', $contact['email']['id'])
       ->setDebug(TRUE)
       ->execute();
-    $this->assertContains('contact.api_key', $email->debug['undefined_fields']);
-    $this->assertArrayNotHasKey('contact.api_key', $email[0]);
+    $this->assertContains('contact_id.api_key', $email->debug['undefined_fields']);
+    $this->assertArrayNotHasKey('contact_id.api_key', $email[0]);
     $this->assertTrue($isSafe($email[0]), "Should NOT reveal secret details ($key): " . var_export($email[0], 1));
 
     $result = Contact::get()
@@ -137,14 +137,14 @@ class ContactApiKeyTest extends \api\v4\UnitTestCase {
     $result = Email::get(FALSE)
       ->addWhere('contact_id', '=', $contact['id'])
       ->addSelect('email')
-      ->addSelect('contact.api_key')
+      ->addSelect('contact_id.api_key')
       ->execute()
       ->first();
     $this->assertFalse($isSafe($result), "Should reveal secret details ($key): " . var_export($result, 1));
 
     $result = Email::get(TRUE)
       ->addWhere('contact_id', '=', $contact['id'])
-      ->addSelect('contact.api_key')
+      ->addSelect('contact_id.api_key')
       ->execute()
       ->first();
     $this->assertTrue($isSafe($result), "Should NOT reveal secret details ($key): " . var_export($result, 1));
index 8218e5189eac4f9859b3f2b6d97f6c4bc29f5ba2..422ae5215631d4f7e65711627d6e6e04020d7d00 100644 (file)
@@ -96,7 +96,7 @@ class ContactGetTest extends \api\v4\UnitTestCase {
       $msg = $e->getMessage();
     }
     $this->assertRegExp(';Expected to find one Contact record;', $msg);
-    $limit1 = Contact::get(FALSE)->setLimit(1)->execute();
+    $limit1 = Contact::get(FALSE)->addWhere('last_name', '=', $last_name)->setLimit(1)->execute();
     $this->assertCount(1, (array) $limit1);
     $this->assertCount(1, $limit1);
     $this->assertTrue(!empty($limit1->single()['sort_name']));
index efadad04754499b6fbb57678d1d8a2f4e03d4a79..01aeb9efe1b1968b6ad52b315d0fbc4faeba0f30 100644 (file)
@@ -107,10 +107,10 @@ class FkJoinTest extends UnitTestCase {
     $contacts = Contact::get(FALSE)
       ->addWhere('id', '=', $this->getReference('test_contact_1')['id'])
       ->addJoin('Address AS address', TRUE, ['id', '=', 'address.contact_id'], ['address.location_type_id', '=', 1])
-      ->addSelect('id', 'address.country.iso_code')
+      ->addSelect('id', 'address.country_id.iso_code')
       ->execute();
     $this->assertCount(1, $contacts);
-    $this->assertEquals('US', $contacts[0]['address.country.iso_code']);
+    $this->assertEquals('US', $contacts[0]['address.country_id.iso_code']);
   }
 
   public function testExcludeJoin() {
@@ -292,8 +292,8 @@ class FkJoinTest extends UnitTestCase {
 
     $result = Activity::get(FALSE)
       ->addSelect('id', 'contact.id', 'rel.id')
-      ->addJoin('Contact', FALSE, 'ActivityContact', ['contact.record_type_id:name', '=', "'Activity Targets'"])
-      ->addJoin('Contact AS rel', FALSE, 'RelationshipCache', ['rel.far_contact_id', '=', 'contact.id'], ['rel.near_relation:name', '=', '"Child of"'])
+      ->addJoin('Contact', 'LEFT', 'ActivityContact', ['contact.record_type_id:name', '=', "'Activity Targets'"])
+      ->addJoin('Contact AS rel', 'LEFT', 'RelationshipCache', ['rel.far_contact_id', '=', 'contact.id'], ['rel.near_relation:name', '=', '"Child of"'])
       ->addWhere('contact.id', 'IN', [$cid1, $cid2, $cid3])
       ->addOrderBy('id')
       ->execute();
index b5cbf6adb5cf54986259b0b1aa04fb926eea826f..645e1670bdb6a4915d7b78c7e16f962d419f018d 100644 (file)
@@ -234,26 +234,26 @@ class PseudoconstantTest extends BaseCustomValueTest {
       ->execute()->first()['id'];
 
     $emails = Email::get()
-      ->addSelect('location_type_id:name', 'contact.gender_id:label', 'email', 'contact_id')
+      ->addSelect('location_type_id:name', 'contact_id.gender_id:label', 'email', 'contact_id')
       ->addWhere('contact_id', 'IN', [$cid1, $cid2, $cid3])
-      ->addWhere('contact.gender_id:label', 'IN', ['Male', 'Female'])
+      ->addWhere('contact_id.gender_id:label', 'IN', ['Male', 'Female'])
       ->execute()->indexBy('contact_id');
     $this->assertCount(2, $emails);
     $this->assertEquals('Work', $emails[$cid1]['location_type_id:name']);
     $this->assertEquals('Home', $emails[$cid2]['location_type_id:name']);
-    $this->assertEquals('Male', $emails[$cid1]['contact.gender_id:label']);
-    $this->assertEquals('Female', $emails[$cid2]['contact.gender_id:label']);
+    $this->assertEquals('Male', $emails[$cid1]['contact_id.gender_id:label']);
+    $this->assertEquals('Female', $emails[$cid2]['contact_id.gender_id:label']);
 
     $emails = Email::get()
-      ->addSelect('location_type_id:name', 'contact.gender_id:label', 'email', 'contact_id')
+      ->addSelect('location_type_id:name', 'contact_id.gender_id:label', 'email', 'contact_id')
       ->addWhere('contact_id', 'IN', [$cid1, $cid2, $cid3])
       ->addWhere('location_type_id:name', 'IN', ['Home'])
       ->execute()->indexBy('contact_id');
     $this->assertCount(2, $emails);
     $this->assertEquals('Home', $emails[$cid2]['location_type_id:name']);
     $this->assertEquals('Home', $emails[$cid3]['location_type_id:name']);
-    $this->assertEquals('Female', $emails[$cid2]['contact.gender_id:label']);
-    $this->assertNull($emails[$cid3]['contact.gender_id:label']);
+    $this->assertEquals('Female', $emails[$cid2]['contact_id.gender_id:label']);
+    $this->assertNull($emails[$cid3]['contact_id.gender_id:label']);
   }
 
   public function testTagOptions() {
index 72648d442f1f0cbd3aec0ad4c42b6aee90d0001b..ca10c63603d90165054ff431c69afdd1c5fbc7fe 100644 (file)
@@ -200,16 +200,16 @@ class ContactInterchangeTest extends UnitTestCase implements TransactionalInterf
   public function readNameByActSubjectJoin_4($cid, $strs) {
     $get = ActivityContact::get()
       ->addWhere('record_type_id:label', '=', 'Activity Source')
-      ->addWhere('activity.subject', '=', $strs['api'])
-      ->addSelect('contact.first_name')
+      ->addWhere('activity_id.subject', '=', $strs['api'])
+      ->addSelect('contact_id.first_name')
       ->execute();
-    return $get->first()['contact.first_name'];
+    return $get->first()['contact_id.first_name'];
   }
 
   public function readNameByActSubjectChain_4($cid, $strs) {
     $get = ActivityContact::get()
       ->addWhere('record_type_id:label', '=', 'Activity Source')
-      ->addWhere('activity.subject', '=', $strs['api'])
+      ->addWhere('activity_id.subject', '=', $strs['api'])
       ->setSelect(['activity_id', 'contact_id'])
       ->setChain([
         'the_contact' => [
@@ -252,16 +252,16 @@ class ContactInterchangeTest extends UnitTestCase implements TransactionalInterf
   public function readNameByActDetailsJoin_4($cid, $strs) {
     $get = ActivityContact::get()
       ->addWhere('record_type_id:label', '=', 'Activity Source')
-      ->addWhere('activity.details', '=', $strs['api'])
-      ->addSelect('contact.first_name')
+      ->addWhere('activity_id.details', '=', $strs['api'])
+      ->addSelect('contact_id.first_name')
       ->execute();
-    return $get->first()['contact.first_name'];
+    return $get->first()['contact_id.first_name'];
   }
 
   public function readNameByActDetailsChain_4($cid, $strs) {
     $get = ActivityContact::get()
       ->addWhere('record_type_id:label', '=', 'Activity Source')
-      ->addWhere('activity.details', '=', $strs['api'])
+      ->addWhere('activity_id.details', '=', $strs['api'])
       ->setSelect(['activity_id', 'contact_id'])
       ->setChain([
         'the_contact' => [
index ba2bcb5e42bf944df393e87861e99f32988170b5..49cf86344a27fd20400c800cd796f5f154fc2e80 100644 (file)
@@ -75,29 +75,29 @@ class ContactTypeTest extends UnitTestCase {
 
     $emails = Email::get(FALSE)
       ->addWhere('contact_id', 'IN', [$indiv, $org, $hh])
-      ->addSelect('id', 'contact_id', 'contact.*', 'contact.prefix_id:label')
+      ->addSelect('id', 'contact_id', 'contact_id.*', 'contact_id.prefix_id:label')
       ->execute()
       ->indexBy('contact_id');
 
-    $this->assertArrayHasKey('contact.first_name', $emails[$indiv]);
-    $this->assertArrayNotHasKey('contact.first_name', $emails[$org]);
-    $this->assertArrayNotHasKey('contact.first_name', $emails[$hh]);
+    $this->assertArrayHasKey('contact_id.first_name', $emails[$indiv]);
+    $this->assertArrayNotHasKey('contact_id.first_name', $emails[$org]);
+    $this->assertArrayNotHasKey('contact_id.first_name', $emails[$hh]);
 
-    $this->assertEquals('Dr.', $emails[$indiv]['contact.prefix_id:label']);
-    $this->assertArrayNotHasKey('contact.prefix_id:label', $emails[$org]);
-    $this->assertArrayNotHasKey('contact.prefix_id:label', $emails[$hh]);
+    $this->assertEquals('Dr.', $emails[$indiv]['contact_id.prefix_id:label']);
+    $this->assertArrayNotHasKey('contact_id.prefix_id:label', $emails[$org]);
+    $this->assertArrayNotHasKey('contact_id.prefix_id:label', $emails[$hh]);
 
-    $this->assertArrayHasKey('contact.organization_name', $emails[$org]);
-    $this->assertArrayNotHasKey('contact.organization_name', $emails[$indiv]);
-    $this->assertArrayNotHasKey('contact.organization_name', $emails[$hh]);
+    $this->assertArrayHasKey('contact_id.organization_name', $emails[$org]);
+    $this->assertArrayNotHasKey('contact_id.organization_name', $emails[$indiv]);
+    $this->assertArrayNotHasKey('contact_id.organization_name', $emails[$hh]);
 
-    $this->assertArrayHasKey('contact.sic_code', $emails[$org]);
-    $this->assertArrayNotHasKey('contact.sic_code', $emails[$indiv]);
-    $this->assertArrayNotHasKey('contact.sic_code', $emails[$hh]);
+    $this->assertArrayHasKey('contact_id.sic_code', $emails[$org]);
+    $this->assertArrayNotHasKey('contact_id.sic_code', $emails[$indiv]);
+    $this->assertArrayNotHasKey('contact_id.sic_code', $emails[$hh]);
 
-    $this->assertArrayHasKey('contact.household_name', $emails[$hh]);
-    $this->assertArrayNotHasKey('contact.household_name', $emails[$org]);
-    $this->assertArrayNotHasKey('contact.household_name', $emails[$indiv]);
+    $this->assertArrayHasKey('contact_id.household_name', $emails[$hh]);
+    $this->assertArrayNotHasKey('contact_id.household_name', $emails[$org]);
+    $this->assertArrayNotHasKey('contact_id.household_name', $emails[$indiv]);
 
   }
 
index 5b84bc27f8fff8bf08717ea1dd95833b29f9da96..a27eaf57afc19feafaf5632dea26888a318aa404 100644 (file)
@@ -54,7 +54,7 @@ class Api4SelectQueryTest extends UnitTestCase {
     $api = Request::create('Phone', 'get', [
       'version' => 4,
       'checkPermissions' => FALSE,
-      'select' => ['id', 'phone', 'contact.display_name', 'contact.first_name'],
+      'select' => ['id', 'phone', 'contact_id.display_name', 'contact_id.first_name'],
       'where' => [['phone', '=', $phoneNum]],
     ]);
     $query = new Api4SelectQuery($api);
@@ -62,7 +62,7 @@ class Api4SelectQueryTest extends UnitTestCase {
 
     $this->assertCount(1, $results);
     $firstResult = array_shift($results);
-    $this->assertEquals($contact['display_name'], $firstResult['contact.display_name']);
+    $this->assertEquals($contact['display_name'], $firstResult['contact_id.display_name']);
   }
 
   /**
index 4a6c233c04a0151dabea80f82807deb7a09d0483..872113b008c2955df4570212bb66daaf11cf281d 100644 (file)
@@ -91,13 +91,13 @@ class PermissionCheckTest extends UnitTestCase {
       0)
       ->execute()->first();
     $participant = Participant::get()
-      ->addSelect('contact.first_name', 'event.title')
-      ->addWhere('event.id', '=', $event['id'])
+      ->addSelect('contact_id.first_name', 'event_id.title')
+      ->addWhere('event_id.id', '=', $event['id'])
       ->execute()
       ->first();
 
-    $this->assertEquals('ABC123 Event', $participant['event.title']);
-    $this->assertEquals($name, $participant['contact.first_name']);
+    $this->assertEquals('ABC123 Event', $participant['event_id.title']);
+    $this->assertEquals($name, $participant['contact_id.first_name']);
 
     // Remove access to view events
     $config->userPermissionClass->permissions = [
@@ -107,14 +107,14 @@ class PermissionCheckTest extends UnitTestCase {
       'view event participants',
     ];
     $participant = Participant::get()
-      ->addSelect('contact.first_name')
-      ->addSelect('event.title')
+      ->addSelect('contact_id.first_name')
+      ->addSelect('event_id.title')
       ->addWhere('id', '=', $contact['participant']['id'])
       ->execute()
       ->first();
 
-    $this->assertTrue(empty($participant['event.title']));
-    $this->assertEquals($name, $participant['contact.first_name']);
+    $this->assertTrue(empty($participant['event_id.title']));
+    $this->assertEquals($name, $participant['contact_id.first_name']);
 
   }
 
index 31c718088ac6e56216ab7b441f620e4d1c49860f..ee604db363315fe185c0534af34cb9179ccc9140 100644 (file)
@@ -37,7 +37,7 @@ class SelectQueryMultiJoinTest extends UnitTestCase {
 
   public function testManyToOneSelect() {
     $results = Email::get()
-      ->addSelect('contact.display_name')
+      ->addSelect('contact_id.display_name')
       ->execute()
       ->indexBy('id');
 
@@ -49,7 +49,7 @@ class SelectQueryMultiJoinTest extends UnitTestCase {
     $secondContactEmailIds = [$thirdEmail['id'], $fourthEmail['id']];
 
     foreach ($results as $id => $email) {
-      $displayName = $email['contact.display_name'];
+      $displayName = $email['contact_id.display_name'];
       if (in_array($id, $firstContactEmailIds)) {
         $this->assertEquals('First Contact', $displayName);
       }
index 30c5bde34637f529ae0f29547094259917524830..b6557571cbe8ac8972f618bb6b62df03408ca394 100644 (file)
@@ -49,8 +49,8 @@ class SpecFormatterTest extends UnitTestCase {
 
     $data = [
       'custom_group_id' => $customGroupId,
-      'custom_group.name' => 'my_group',
-      'custom_group.title' => 'My Group',
+      'custom_group_id.name' => 'my_group',
+      'custom_group_id.title' => 'My Group',
       'id' => $customFieldId,
       'name' => $name,
       'label' => $name,
index e827759ad330ac6a3fd6c15d90aa1e8a565c2ab3..a5f173ed3a13d2bc7722886b7aca6a1ddb1fd526 100644 (file)
@@ -40,12 +40,12 @@ class SelectUtilTest extends UnitTestCase {
     'reset_date',
     'signature_text',
     'signature_html',
-    'contact.id',
-    'contact.display_name',
-    'contact.sort_name',
-    'contact.phone.id',
-    'contact.phone.phone',
-    'contact.phone.phone_type_id',
+    'contact_id.id',
+    'contact_id.display_name',
+    'contact_id.sort_name',
+    'contact_id.phone.id',
+    'contact_id.phone.phone',
+    'contact_id.phone.phone_type_id',
   ];
 
   public function getSelectExamples() {
@@ -81,10 +81,10 @@ class SelectUtilTest extends UnitTestCase {
       [['contact_id'], 'con*_id'],
       [['is_primary', 'is_billing', 'is_bulkmail'], 'is_*'],
       [['is_billing', 'is_bulkmail'], 'is_*l*'],
-      [['contact.id', 'contact.display_name', 'contact.sort_name'], 'contact.*'],
-      [['contact.display_name', 'contact.sort_name'], 'contact.*_name'],
-      [['contact.phone.id', 'contact.phone.phone', 'contact.phone.phone_type_id'], 'contact.phone.*'],
-      [['contact.phone.phone', 'contact.phone.phone_type_id'], 'contact.phone.phone*'],
+      [['contact_id.id', 'contact_id.display_name', 'contact_id.sort_name'], 'contact_id.*'],
+      [['contact_id.display_name', 'contact_id.sort_name'], 'contact_id.*_name'],
+      [['contact_id.phone.id', 'contact_id.phone.phone', 'contact_id.phone.phone_type_id'], 'contact_id.phone.*'],
+      [['contact_id.phone.phone', 'contact_id.phone.phone_type_id'], 'contact_id.phone.phone*'],
     ];
   }