1401d2ba1da9cce62416b9df818cf69aa02a7f9f
4 * Class CRM_Core_DAO_Factory
6 class CRM_Core_DAO_Factory
{
8 public static $_classes = [
10 'Country' => 'singleton',
11 'County' => 'singleton',
12 'StateProvince' => 'singleton',
13 'GeoCoord' => 'singleton',
14 'IMProvider' => 'singleton',
15 'MobileProvider' => 'singleton',
18 public static $_prefix = [
19 'business' => 'CRM_Core_BAO_',
20 'data' => 'CRM_Core_DAO_',
24 * @param string $className
27 * @throws CRM_Core_Exception
29 public static function create($className) {
30 $type = self
::$_classes[$className] ??
NULL;
32 throw new CRM_Core_Exception("class $className not found");
35 $class = self
::$_prefix[$type] . $className;
37 if ($type == 'singleton') {
38 $newObj = $class::singleton();
41 // this is either 'business' or 'data'
42 $newObj = new $class();