DAO - addSelectWhereClause should always return an array
authorcolemanw <coleman@civicrm.org>
Sun, 17 Sep 2023 19:59:42 +0000 (15:59 -0400)
committercolemanw <coleman@civicrm.org>
Wed, 20 Sep 2023 11:30:24 +0000 (07:30 -0400)
13 files changed:
CRM/Activity/BAO/Activity.php
CRM/Case/BAO/Case.php
CRM/Case/BAO/CaseContact.php
CRM/Contact/BAO/Contact.php
CRM/Contact/BAO/Group.php
CRM/Contact/BAO/Query.php
CRM/Contact/BAO/RelationshipCache.php
CRM/Core/BAO/CustomValue.php
CRM/Core/BAO/File.php
CRM/Core/BAO/UFJoin.php
CRM/Core/BAO/UFMatch.php
CRM/Core/DAO.php
ext/oauth-client/CRM/OAuth/BAO/OAuthContactToken.php

index 4aaa2e596d2541d3d4792931dedf4868e0ef5772..3d320dafb8f3904fe4e1694011be755250497eb9 100644 (file)
@@ -803,7 +803,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
   /**
    * @inheritDoc
    */
-  public function addSelectWhereClause() {
+  public function addSelectWhereClause(): array {
     $clauses = [];
     $permittedActivityTypeIDs = self::getPermittedActivityTypes();
     $allActivityTypes = self::buildOptions('activity_type_id', 'validate');
index aaa7fab22b65c1307a8f880b651890e372dff3c2..68cc1c1a7ff44f1315f93601aa9f79bc93a84f7a 100644 (file)
@@ -3015,7 +3015,7 @@ WHERE id IN (' . implode(',', $copiedActivityIds) . ')';
   /**
    * @inheritDoc
    */
-  public function addSelectWhereClause() {
+  public function addSelectWhereClause(): array {
     // We always return an array with these keys, even if they are empty,
     // because this tells the query builder that we have considered these fields for acls
     $clauses = [
index af7086c7c28b2c6d5a777a9602380ed3bdb94362..d1fa6ceb2545c211854ab47b683f253cb5578eb3 100644 (file)
@@ -73,7 +73,7 @@ class CRM_Case_BAO_CaseContact extends CRM_Case_DAO_CaseContact implements \Civi
   /**
    * @inheritDoc
    */
-  public function addSelectWhereClause() {
+  public function addSelectWhereClause(): array {
     return [
       // Reuse case acls
       'case_id' => CRM_Utils_SQL::mergeSubquery('Case'),
index f443fef15f5c3551ab03e47c213c0b05678638ea..f5635b1e5ee684b68d44f577d58c123f8552cfbc 100644 (file)
@@ -3411,7 +3411,7 @@ LEFT JOIN civicrm_address ON ( civicrm_address.contact_id = civicrm_contact.id )
   /**
    * @inheritDoc
    */
-  public function addSelectWhereClause() {
+  public function addSelectWhereClause(): array {
     // We always return an array with these keys, even if they are empty,
     // because this tells the query builder that we have considered these fields for acls
     $clauses = [
index e39077b4db394dd0e4ec1bbee50f6f518ee98517..617d09e4ef78531b943516c63e30075a6a251b6b 100644 (file)
@@ -312,7 +312,7 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
   /**
    * @inheritDoc
    */
-  public function addSelectWhereClause() {
+  public function addSelectWhereClause(): array {
     $clauses = [];
     if (!CRM_Core_Permission::check([['edit all contacts', 'view all contacts']])) {
       $allowedGroups = CRM_Core_Permission::group(NULL, FALSE);
index 8642c163bc60a137a02a434177cd16a34ea3ca0b..9f015588926862e3ce62480577a300184e4fb738 100644 (file)
@@ -5080,7 +5080,7 @@ civicrm_relationship.start_date > {$today}
       if (isset($this->_tables['civicrm_activity'])) {
         $bao = new CRM_Activity_BAO_Activity();
         $clauses = $subclauses = [];
-        foreach ((array) $bao->addSelectWhereClause() as $field => $vals) {
+        foreach ($bao->addSelectWhereClause() as $field => $vals) {
           if ($vals && $field !== 'id') {
             $clauses[] = $bao->tableName() . ".$field " . $vals;
           }
index 54906ee2e917fb61c6490c2f92ef1997193da55b..b7fbaa26909fe21b8ea9c8ce2b7e3d3d6b6d51e3 100644 (file)
@@ -158,7 +158,7 @@ class CRM_Contact_BAO_RelationshipCache extends CRM_Contact_DAO_RelationshipCach
   /**
    * @return array
    */
-  public function addSelectWhereClause() {
+  public function addSelectWhereClause(): array {
     // Permission for this entity depends on access to the two related contacts.
     $contactClause = CRM_Utils_SQL::mergeSubquery('Contact');
     $clauses = [
index 88024d0b86caac75f475f1cb7716eaed0481e355..9a00a61b684297d6143a6b4e711bf57c5fe94b1e 100644 (file)
@@ -214,7 +214,7 @@ class CRM_Core_BAO_CustomValue extends CRM_Core_DAO {
    * ACL clause for an APIv4 custom pseudo-entity (aka multi-record custom group extending Contact).
    * @return array
    */
-  public function addSelectWhereClause() {
+  public function addSelectWhereClause(): array {
     $clauses = [
       'entity_id' => CRM_Utils_SQL::mergeSubquery('Contact'),
     ];
index 98b5abd38ad8d3dc9981275b162358d73c1e426f..6c24a6078da600493d2e5f8e0fa84eb6454b0b73 100644 (file)
@@ -837,7 +837,7 @@ HEREDOC;
   /**
    * @inheritDoc
    */
-  public function addSelectWhereClause() {
+  public function addSelectWhereClause(): array {
     // TODO: This seemded like a good idea... piggybacking off the ACL clause of EntityFile
     // however that's too restrictive because entityFile ACLs are limited to just attachments,
     // so this would prevent access to other file fields (e.g. custom fields)
index 493594176dc7f49687c54106ea54e186abd2d1f6..d89e2cd46b0bf2619e1286dde155b2a71b88fc81 100644 (file)
@@ -180,7 +180,7 @@ class CRM_Core_BAO_UFJoin extends CRM_Core_DAO_UFJoin {
    *
    * @return array
    */
-  public function addSelectWhereClause() {
+  public function addSelectWhereClause(): array {
     $clauses = [];
     CRM_Utils_Hook::selectWhereClause($this, $clauses);
     return $clauses;
index d3ef5951493825ed392607f373f8c46a6f3eb26c..4c2317222c90841f59b5f50365276b1ac75e57d2 100644 (file)
@@ -618,7 +618,7 @@ AND    domain_id    = %4
   /**
    * @inheritDoc
    */
-  public function addSelectWhereClause() {
+  public function addSelectWhereClause(): array {
     // Prevent default behavior of joining ACLs onto the contact_id field.
     $clauses = [];
     CRM_Utils_Hook::selectWhereClause($this, $clauses);
index b980479fcbdf980d5069719d8f9e1fa2e0249a5b..fd0b562fd605b6b236f6a0d0efada23aa987d228 100644 (file)
@@ -3068,7 +3068,7 @@ SELECT contact_id
    *
    * @return array
    */
-  public function addSelectWhereClause() {
+  public function addSelectWhereClause(): array {
     $clauses = [];
     $fields = $this->fields();
     // Notes should check permissions on the entity_id field, not the contact_id field
index 69228fb62259f653259fcfe2f8cfa8acefc00512..6fbe616ac61ec0ac27013733968a0948e4efae44 100644 (file)
@@ -99,7 +99,7 @@ class CRM_OAuth_BAO_OAuthContactToken extends CRM_OAuth_DAO_OAuthContactToken {
   /**
    * @inheritDoc
    */
-  public function addSelectWhereClause() {
+  public function addSelectWhereClause(): array {
     $clauses = [];
     $loggedInContactID = CRM_Core_Session::getLoggedInContactID();