2 class CRM_Core_DAO_Factory
{
4 static $_classes = array(
6 'Country' => 'singleton',
7 'County' => 'singleton',
8 'StateProvince' => 'singleton',
9 'GeoCoord' => 'singleton',
10 'IMProvider' => 'singleton',
11 'MobileProvider' => 'singleton',
14 static $_prefix = array(
15 'business' => 'CRM/Core/BAO/',
16 'data' => 'CRM/Core/DAO/',
19 static $_suffix = '.php';
21 static function &create($className) {
22 $type = CRM_Utils_Array
::value($className, self
::$_classes);
24 CRM_Core_Error
::fatal("class $className not found");
27 $file = self
::$_prefix[$type] . $className;
28 $class = str_replace('/', '_', $file);
30 require_once ($file . self
::$_suffix);
32 if ($type == 'singleton') {
33 $newObj = $class::singleton();
36 // this is either 'business' or 'data'