4 * Class CRM_Core_DAO_Factory
6 class CRM_Core_DAO_Factory
{
8 static $_classes = array(
10 'Country' => 'singleton',
11 'County' => 'singleton',
12 'StateProvince' => 'singleton',
13 'GeoCoord' => 'singleton',
14 'IMProvider' => 'singleton',
15 'MobileProvider' => 'singleton',
18 static $_prefix = array(
19 'business' => 'CRM/Core/BAO/',
20 'data' => 'CRM/Core/DAO/',
23 static $_suffix = '.php';
26 * @param string $className
31 static function &create($className) {
32 $type = CRM_Utils_Array
::value($className, self
::$_classes);
34 CRM_Core_Error
::fatal("class $className not found");
37 $file = self
::$_prefix[$type] . $className;
38 $class = str_replace('/', '_', $file);
40 require_once($file . self
::$_suffix);
42 if ($type == 'singleton') {
43 $newObj = $class::singleton();
46 // this is either 'business' or 'data'