From: Coleman Watts <coleman@civicrm.org>
Date: Sat, 21 Aug 2021 20:10:36 +0000 (-0400)
Subject: Remove unused, duplicate functions getEntitiesByTag
X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8ce0aec87b8b2fcdba94413819388e46bcd9af4e;p=civicrm-core.git

Remove unused, duplicate functions getEntitiesByTag

According to https://issues.civicrm.org/jira/browse/CRM-13156
the functions were only ever used in the v2 API, which no longer exists.
---

diff --git a/CRM/Campaign/BAO/Petition.php b/CRM/Campaign/BAO/Petition.php
index a13450f148..5d3d55a5f0 100644
--- a/CRM/Campaign/BAO/Petition.php
+++ b/CRM/Campaign/BAO/Petition.php
@@ -448,27 +448,6 @@ AND         tag_id = ( SELECT id FROM civicrm_tag WHERE name = %2 )";
     return $signature;
   }
 
-  /**
-   * This function returns all entities assigned to a specific tag.
-   *
-   * @param object $tag
-   *   An object of a tag.
-   *
-   * @return array
-   *   array of contact ids
-   */
-  public function getEntitiesByTag($tag) {
-    $contactIds = [];
-    $entityTagDAO = new CRM_Core_DAO_EntityTag();
-    $entityTagDAO->tag_id = $tag['id'];
-    $entityTagDAO->find();
-
-    while ($entityTagDAO->fetch()) {
-      $contactIds[] = $entityTagDAO->entity_id;
-    }
-    return $contactIds;
-  }
-
   /**
    * Check if contact has signed this petition.
    *
diff --git a/CRM/Core/BAO/EntityTag.php b/CRM/Core/BAO/EntityTag.php
index 9000ade79c..e2a6ba032f 100644
--- a/CRM/Core/BAO/EntityTag.php
+++ b/CRM/Core/BAO/EntityTag.php
@@ -290,26 +290,6 @@ class CRM_Core_BAO_EntityTag extends CRM_Core_DAO_EntityTag {
     }
   }
 
-  /**
-   * This function returns all entities assigned to a specific tag.
-   *
-   * @param object $tag
-   *   An object of a tag.
-   *
-   * @return array
-   *   array of entity ids
-   */
-  public function getEntitiesByTag($tag) {
-    $entityIds = [];
-    $entityTagDAO = new CRM_Core_DAO_EntityTag();
-    $entityTagDAO->tag_id = $tag->id;
-    $entityTagDAO->find();
-    while ($entityTagDAO->fetch()) {
-      $entityIds[] = $entityTagDAO->entity_id;
-    }
-    return $entityIds;
-  }
-
   /**
    * Get contact tags.
    *