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
29 public static function create($className) {
30 $type = CRM_Utils_Array
::value($className, self
::$_classes);
32 CRM_Core_Error
::fatal("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();