Ejemplo n.º 1
0
 /**
  * 单例模式
  * @param DataBase $db 数据库连接
  */
 public static function &instance($db)
 {
     if (!isset(Group_Contact_Mapper::$instance)) {
         // Create a new instance
         Group_Contact_Mapper::$instance = new Group_Contact_Mapper($db);
     }
     return Group_Contact_Mapper::$instance;
 }
Ejemplo n.º 2
0
 /**
  * 构造函数,
  * 为了避免循环实例化,请调用单例模式
  */
 public function __construct()
 {
     parent::__construct();
     $this->cache = Cache::instance();
     $this->group_contact_mapper = Group_Contact_Mapper::instance($this->db);
 }