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 $_preCall = array(
27 static $_extCall = array(
28 'singleton' => '::singleton',
35 function &create($className) {
36 $type = CRM_Utils_Array
::value($className, self
::$_classes);
38 CRM_Core_Error
::fatal("class $className not found");
41 $file = self
::$_prefix[$type] . $className;
42 $class = str_replace('/', '_', $file);
44 require_once ($file . self
::$_suffix);
46 $newObj = eval(sprintf("return %s %s%s();",
47 self
::$_preCall[$type],
49 self
::$_extCall[$type]