Remove unused CRM_Contact_DAO_Factory
authorColeman Watts <coleman@civicrm.org>
Sat, 1 Apr 2023 23:58:49 +0000 (19:58 -0400)
committerColeman Watts <coleman@civicrm.org>
Sat, 1 Apr 2023 23:58:49 +0000 (19:58 -0400)
CRM/Contact/DAO/Factory.php [deleted file]
CRM/Core/DAO.php

diff --git a/CRM/Contact/DAO/Factory.php b/CRM/Contact/DAO/Factory.php
deleted file mode 100644 (file)
index ef11dad..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-
-/**
- * Class CRM_Contact_DAO_Factory
- */
-class CRM_Contact_DAO_Factory {
-
-  public static $_classes = [
-    'Address' => 'data',
-    'Contact' => 'data',
-    'Email' => 'data',
-    'Household' => 'data',
-    'IM' => 'data',
-    'Individual' => 'data',
-    'Location' => 'data',
-    'LocationType' => 'data',
-    'Organization' => 'data',
-    'Phone' => 'data',
-    'Relationship' => 'data',
-  ];
-
-  public static $_prefix = [
-    'business' => 'CRM_Contact_BAO_',
-    'data' => 'CRM_Contact_DAO_',
-  ];
-
-  /**
-   * @param string $className
-   *
-   * @return mixed
-   */
-  public static function create($className) {
-    $type = self::$_classes[$className] ?? NULL;
-    if (!$type) {
-      return CRM_Core_DAO_Factory::create($className);
-    }
-
-    $class = self::$_prefix[$type] . $className;
-
-    if ($type == 'singleton') {
-      $newObj = $class::singleton();
-    }
-    else {
-      // this is either 'business' or 'data'
-      $newObj = new $class();
-    }
-
-    return $newObj;
-  }
-
-}
index f1adb67e43939eca2d542dab5ecffd8645b11577..46a9026eaf69cd7844c5be6c89fa96b5588eb857 100644 (file)
@@ -134,11 +134,6 @@ class CRM_Core_DAO extends DB_DataObject {
    * @var array
    */
   public static $_testEntitiesToSkip = [];
-  /**
-   * The factory class for this application.
-   * @var object
-   */
-  public static $_factory = NULL;
 
   /**
    * https://issues.civicrm.org/jira/browse/CRM-17748
@@ -231,8 +226,6 @@ class CRM_Core_DAO extends DB_DataObject {
     if (defined('CIVICRM_DAO_DEBUG')) {
       self::DebugLevel(CIVICRM_DAO_DEBUG);
     }
-    $factory = new CRM_Contact_DAO_Factory();
-    CRM_Core_DAO::setFactory($factory);
     CRM_Core_DAO::executeQuery('SET NAMES utf8mb4');
     CRM_Core_DAO::executeQuery('SET @uniqueID = %1', [1 => [CRM_Utils_Request::id(), 'String']]);
   }
@@ -497,30 +490,6 @@ class CRM_Core_DAO extends DB_DataObject {
     return $ret;
   }
 
-  /**
-   * Static function to set the factory instance for this class.
-   *
-   * @param object $factory
-   *   The factory application object.
-   */
-  public static function setFactory(&$factory) {
-    self::$_factory = &$factory;
-  }
-
-  /**
-   * Factory method to instantiate a new object from a table name.
-   *
-   * @param string $table
-   * @return \DataObject|\PEAR_Error
-   */
-  public function factory($table = '') {
-    if (!isset(self::$_factory)) {
-      return parent::factory($table);
-    }
-
-    return self::$_factory->create($table);
-  }
-
   /**
    * Initialization for all DAO objects. Since we access DB_DO programatically
    * we need to set the links manually.