X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContact%2FDAO%2FFactory.php;h=e26ad410e8865bad6c1a6ab7ea6b471db55dae06;hb=2c6bbd0646494e3ce48ea7e87f88c90dfaf5f64a;hp=d4b89050efcfa1a01e50613cdcf5c0a6dded0f0e;hpb=f813f78ee5bbec2338615b1973fc4bab4f11960f;p=civicrm-core.git diff --git a/CRM/Contact/DAO/Factory.php b/CRM/Contact/DAO/Factory.php index d4b89050ef..e26ad410e8 100644 --- a/CRM/Contact/DAO/Factory.php +++ b/CRM/Contact/DAO/Factory.php @@ -1,5 +1,8 @@ '', - 'business' => 'new', - 'data' => 'new', - ); - - static $_extCall = array( - 'singleton' => '::singleton', - 'business' => '', - 'data' => '', - ); - - - static - function &create($className) { + /** + * @param string $className + * + * @return mixed + */ + static function &create($className) { $type = CRM_Utils_Array::value($className, self::$_classes); if (!$type) { return CRM_Core_DAO_Factory::create($className); @@ -48,13 +42,14 @@ class CRM_Contact_DAO_Factory { require_once ($file . self::$_suffix); - $newObj = eval(sprintf("return %s %s%s();", - self::$_preCall[$type], - $class, - self::$_extCall[$type] - )); + if ($type == 'singleton') { + $newObj = $class::singleton(); + } + else { + // this is either 'business' or 'data' + $newObj = new $class; + } return $newObj; } } -